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


PHP Sentry::findUserByActivationCode方法代码示例

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


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

示例1: doUserActivate

 public function doUserActivate($code)
 {
     try {
         $user = Sentry::findUserByActivationCode($code);
         $user->attemptActivation($code);
         if ($user->isActivated()) {
             $user->password = Input::get('password');
             $user->save();
             Sentry::login($user);
             $data = array('status' => true, 'link' => URL::to('user/cabinet'));
             return Response::json($data);
         }
     } catch (UserNotFoundException $e) {
         App::abort('404');
     }
 }
开发者ID:OlesKashchenko,项目名称:SkillsProject2,代码行数:16,代码来源:UserCabinetController.php

示例2: getActivation

 /**
  * Actiovation account
  */
 public function getActivation($code = null)
 {
     if (Session::get('activated')) {
         return View::make(Config::get('larauth::views.activation'));
     }
     if (Input::get('code')) {
         $code = Input::get('code');
     }
     if ($code) {
         try {
             $user = Sentry::findUserByActivationCode($code);
             $user->attemptActivation($code);
             // добавляем пользователя в группы
             foreach (Config::get('larauth::append_groups') as $group) {
                 try {
                     $oGroup = Sentry::findGroupByName($group);
                 } catch (\Cartalyst\Sentry\Groups\GroupNotFoundException $e) {
                     Log::alert("Попытка добавдения пользователя :user_email в несуществующую группу :group", ['user_email' => $user->email, 'group' => $group]);
                 }
                 $user->addGroup($oGroup);
             }
             $data = ['email' => $user->email, 'password' => Cache::pull(md5($user->email)), 'subject' => trans('larauth::larauth.registration_success')];
             $this->sendMail(Config::get('larauth::views.mail_registration'), $data);
             return Redirect::route('larauth.activation')->with('activated', TRUE);
         } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
             return Redirect::route('larauth.activation')->with('error', trans('larauth::larauth.wrong_activation_code'));
         }
     }
     return View::make(Config::get('larauth::views.activation'), ['error' => Session::get('error'), 'code' => $code]);
 }
开发者ID:bitw,项目名称:larauth,代码行数:33,代码来源:LarauthController.php

示例3: activateUser

 /**
  * @param $activationcode
  *
  * Activate a user when he clicks the link in the mailbox.
  */
 function activateUser($activationcode)
 {
     try {
         $user = Sentry::findUserByActivationCode($activationcode);
         if ($user->attemptActivation($activationcode)) {
             // User activation passed
             return Redirect::to('login')->with('success', 'User successfully activated');
         } else {
             // User activation failed
             return Redirect::to('login')->with('message', 'Ooops, something went wrong please contact the system administrator.');
         }
     } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
         echo 'User was not found.';
     } catch (Cartalyst\Sentry\Users\UserAlreadyActivatedException $e) {
         echo 'User is already activated.';
     }
     // return 'lets veryify this ' . $activationcode;
 }
开发者ID:duikb00t,项目名称:lp,代码行数:23,代码来源:AuthController.php

示例4: activate

 public function activate($code)
 {
     try {
         $user = Sentry::findUserByActivationCode($code);
         try {
             if ($user->attemptActivation($code)) {
                 Session::flash('success', trans('user.activate.success'));
             } else {
                 Session::flash('error', trans('user.activate.error'));
             }
         } catch (Cartalyst\Sentry\Users\UserAlreadyActivatedException $e) {
             Session::flash('warning', trans('user.activate.already-activated'));
         }
     } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
         Session::flash('error', trans('user.activate.not-found'));
         return Redirect::route('user.register');
     }
     return Redirect::route('home');
 }
开发者ID:dbirchak,项目名称:ping,代码行数:19,代码来源:UserController.php


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