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


PHP YumUser::activate方法代码示例

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


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

示例1: actionActivation

 /**
  * Activation of an user account. The Email and the Activation key send
  * by email needs to correct in order to continue. The Status will
  * be initially set to 1 (active - first Visit) so the administrator
  * can see, which accounts have been activated, but not yet logged in 
  * (more than once)
  */
 public function actionActivation($email, $key)
 {
     // If already logged in, we dont activate anymore
     if (!Yii::app()->user->isGuest) {
         Yum::setFlash('You are already logged in, please log out to activate your account');
         $this->redirect(Yii::app()->user->returnUrl);
     }
     // If everything is set properly, let the model handle the Validation
     // and do the Activation
     $status = YumUser::activate($email, $key);
     if ($status instanceof YumUser) {
         if (Yum::module('registration')->loginAfterSuccessfulActivation) {
             $login = new YumUserIdentity($status->username, false);
             $login->authenticate(true);
             Yii::app()->user->login($login);
         }
         $this->render(Yum::module('registration')->activationSuccessView);
     } else {
         $this->render(Yum::module('registration')->activationFailureView, array('error' => $status));
     }
 }
开发者ID:kumarsivarajan,项目名称:yii-user-management,代码行数:28,代码来源:YumRegistrationController.php


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