当前位置: 首页>>代码示例>>PHP>>正文


PHP Sentinel::authenticate方法代码示例

本文整理汇总了PHP中Sentinel::authenticate方法的典型用法代码示例。如果您正苦于以下问题:PHP Sentinel::authenticate方法的具体用法?PHP Sentinel::authenticate怎么用?PHP Sentinel::authenticate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sentinel的用法示例。


在下文中一共展示了Sentinel::authenticate方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: signUp

 public function signUp()
 {
     if ($this->app->request()->isPost()) {
         $v = $this->validator($this->post());
         $v->rule('required', array('email', 'password'));
         $v->rule('email', 'email');
         $v->rule('length', 'password', 3, 11);
         if ($v->validate()) {
             try {
                 $credentials = array('email' => $this->post('email'), 'password' => $this->post('password'));
                 $user = Sentinel::register($credentials, true);
                 if ($user) {
                     /* Login right after signup */
                     Sentinel::authenticate($credentials);
                     $this->successFlash('Your registration was successful.');
                     $this->redirect('home');
                 } else {
                     $this->errorFlash('User information was not updated successfully.');
                 }
             } catch (UserExistsException $e) {
                 $this->errorFlash('User with this login already exists.');
             } catch (UserNotFoundException $e) {
                 $this->errorFlash('User was not found.');
             }
         }
         $this->app->flashNow('error', $this->errorOutput($v->errors()));
     }
     $this->render('login/signup');
 }
开发者ID:EpykOS,项目名称:epykosLittleHelper,代码行数:29,代码来源:login.controller.php

示例2: _before

 public function _before(FunctionalTester $I)
 {
     // we create a user
     $this->_credentials = ['gender' => config('user.gender_key.male'), 'last_name' => 'Test', 'first_name' => 'test', 'birth_date' => '1985-03-24', 'phone_number' => '+33 6 66 66 66 66', 'email' => 'test@test.fr', 'address' => '7 impasse du Taureau Ailé', 'zip_code' => 44300, 'city' => 'Nantes', 'country' => 'France', 'status_id' => config('user.status_key.communication_commission'), 'board_id' => config('user.board_key.leading_board'), 'password' => 'test'];
     $this->_user = \Sentinel::register($this->_credentials, true);
     // we log this user
     \Sentinel::authenticate($this->_credentials);
 }
开发者ID:Okipa,项目名称:una.app,代码行数:8,代码来源:UserCest.php

示例3: handle

 /**
  * Handle the event.
  *
  * @param  Login $event
  * @return boolean
  */
 public function handle(Login $event)
 {
     try {
         \Sentinel::authenticate((array) $event->credentials);
         return true;
     } catch (\Exception $e) {
         return false;
     }
 }
开发者ID:tankerkiller125,项目名称:newscms,代码行数:15,代码来源:LoginListener.php

示例4: _before

 public function _before(FunctionalTester $I)
 {
     // we set the credentials
     $this->_credentials = ['last_name' => 'Test', 'first_name' => 'test', 'email' => 'test@test.fr', 'status' => config('user.status_key.communication_commission'), 'board' => config('user.board_key.leading_board'), 'password' => 'test'];
     // we create the user
     $this->_user = \Sentinel::register($this->_credentials, true);
     // we log the user
     \Sentinel::authenticate($this->_credentials);
 }
开发者ID:Okipa,项目名称:una.app,代码行数:9,代码来源:PermissionCest.php

示例5: Login

 /**
  * Login User
  *
  * @param AccountLogin $request
  *
  * @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function Login(AccountLogin $request)
 {
     $credentials = array('email' => \Input::get('email'), 'password' => \Input::get('password'));
     try {
         $user = \Sentinel::authenticate($credentials, \Input::get('remember_me'));
         \Sentinel::getUserRepository()->recordLogin($user);
         if (\Sentinel::check()) {
             return redirect('/');
         }
     } catch (\Exception $e) {
         return redirect('auth/login')->withErrors(array('login' => trans('auth.errors.login')));
     }
 }
开发者ID:brucewu16899,项目名称:Core,代码行数:20,代码来源:AuthController.php

示例6: login

 /**
  * Handle posting of the form for logging the user in.
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function login()
 {
     try {
         $input = Input::all();
         $remember = (bool) array_pull($input, 'remember', false);
         $rules = ['email' => 'required|email', 'password' => 'required'];
         $validator = Validator::make($input, $rules);
         if ($validator->fails()) {
             return Redirect::back()->withInput()->withErrors($validator);
         }
         if ($auth = Sentinel::authenticate($input, $remember)) {
             return Redirect::intended('account')->withSuccess('Successfully logged in.');
         }
         $errors = 'Invalid login or password.';
     } catch (NotActivatedException $e) {
         $errors = 'Account is not activated!';
     } catch (ThrottlingException $e) {
         $delay = $e->getDelay();
         $errors = "Your account is blocked for {$delay} second(s).";
     }
     return Redirect::back()->withInput()->withErrors($errors);
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:27,代码来源:AuthController.php

示例7: login

 /**
  * process the login submit.
  *
  * @return Response
  */
 public function login()
 {
     $potential_user = \Pinom\Models\User::where('email', 'LIKE', \Input::has('email') ? \Input::get('email') : '')->first();
     if (!is_null($potential_user) && trim($potential_user->password) == '') {
         //echo "isnull password!";
         $user = \Sentinel::findById($potential_user->id);
         $password = ['password' => $potential_user->id . '.' . $potential_user->email];
         $user = \Sentinel::update($user, $password);
         $activation = \Activation::create($user);
         $activation = \Activation::complete($user, $activation->code);
     }
     $credentials = ['email' => \Input::has('email') ? \Input::get('email') : '', 'password' => \Input::has('passw') ? \Input::get('passw') : ''];
     //echo '<pre>';
     //return redirect('/');
     $user = \Sentinel::authenticate($credentials);
     //print_R($user);
     if ($user = \Sentinel::check()) {
         return redirect('/login');
     } else {
         return redirect('/login');
     }
 }
开发者ID:blare,项目名称:pinom,代码行数:27,代码来源:LoginController.php

示例8: postLogin

 public function postLogin()
 {
     $rules = config('admin.auth.rules');
     $data = \Input::only(array_keys($rules));
     $lang = trans('admin::validation');
     if ($lang == 'admin::validation') {
         $lang = [];
     }
     $validator = \Validator::make($data, $rules, $lang);
     if ($validator->fails()) {
         return \Redirect::back()->withInput()->withErrors($validator);
     }
     if (\Sentinel::authenticate($data)) {
         if (\Sentinel::hasAnyAccess(['superadmin', 'controlpanel'])) {
             return \Redirect::intended(route('admin.wildcard', '/'));
         } else {
             return $this->getLogout();
         }
     }
     $message = new MessageBag(['email' => trans('sentinel::lang.auth.wrong-email'), 'password' => trans('sentinel::lang.auth.wrong-password')]);
     return \Redirect::back()->withInput()->withErrors($message);
 }
开发者ID:johnshepherd,项目名称:soa-sentinel,代码行数:22,代码来源:AuthController.php

示例9: access_to_forgotten_password_page_while_logged_in

 public function access_to_forgotten_password_page_while_logged_in(FunctionalTester $I)
 {
     $I->am('Unlogged user');
     $I->wantTo('access to the forgotten password page while logged in');
     $I->expectTo('be redirected to the home page');
     /***************************************************************************************************************
      * run test
      **************************************************************************************************************/
     \Sentinel::authenticate($this->_credentials);
     $I->amOnPage('/');
     $I->amOnRoute('password.index');
     $I->amOnRoute('home');
 }
开发者ID:Okipa,项目名称:una.app,代码行数:13,代码来源:AuthCest.php

示例10: do_login

 /**
  * Handles the post of the show_login() page
  */
 public function do_login()
 {
     try {
         $remember_me = false;
         if (Input::get('remember_me') == "on") {
             $remember_me = true;
         }
         // Login credentials
         $credentials = array('email' => Input::get('email'), 'password' => Input::get('password'));
         // Authenticate the user
         $user = Sentinel::authenticate($credentials, false);
         //print_r($user);
     } catch (Exception $e) {
         redirect::to('/user/login')->with('message', 'There has been a problem with your login: ' . $e->getMessage());
         exit(0);
     }
     if (!isset($user) | $user == "") {
         redirect::to('/user/login')->with('message', 'There has been a problem with your login');
         exit(0);
     }
     //Check if User has setup his profile
     $setup = SDUserinfo::where('user_id', $user->id)->where('type', 'setup')->first();
     if ($setup != NULL) {
         return Redirect::to('/user/dashboard');
     } else {
         return Redirect::to('/user/profile');
     }
 }
开发者ID:sourcedonates,项目名称:SDv2-Code,代码行数:31,代码来源:UserController.php

示例11: function

    Route::get('destroy', 'CartController@destroy');
    Route::get('count', 'CartController@countAjax');
});
Route::group(['prefix' => 'wishlist'], function () {
    Route::get('/', 'WishlistController@index');
    Route::post('/', 'WishlistController@update');
    Route::get('{id}/add', 'WishlistController@add');
    Route::get('{id}/move', 'WishlistController@move');
    Route::get('{id}/addAjax', 'WishlistController@addAjax');
    Route::get('{id}/remove', 'WishlistController@delete');
    Route::get('{id}/removeAjax', 'WishlistController@deleteAjax');
    Route::get('destroy', 'WishlistController@destroy');
    Route::get('count', 'WishlistController@countAjax');
});
Route::group(['prefix' => 'coupon'], function () {
    Route::post('/', ['as' => 'applyCoupon', 'uses' => 'CartController@applyCoupon']);
    Route::get('remove/{name}', 'CartController@removeCoupon');
});
Route::get('login', function () {
    return View::make('cart.login');
});
Route::post('login', function () {
    if (Sentinel::authenticate(Input::all())) {
        return Redirect::to('/');
    }
    return Redirect::to('login');
});
Route::get('logout', function () {
    Sentinel::logout();
    return Redirect::to('/');
});
开发者ID:Denniskevin,项目名称:demo-cart,代码行数:31,代码来源:routes.php

示例12: _authenticate

 public function _authenticate()
 {
     $Sentinel = new Sentinel();
     $Sentinel->init($this);
     return $Sentinel->authenticate();
 }
开发者ID:bermi,项目名称:admin,代码行数:6,代码来源:admin_controller.php


注:本文中的Sentinel::authenticate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。