activate() 공개 정적인 메소드

If everything is set properly, and the emails exists in the database, and is associated with a correct user, and this user has the status NOTACTIVE and the given activationKey is identical to the one in the database then generate a new Activation key to avoid double activation, set the status to ACTIVATED and save the data Error Codes: -1 : User is not inactive, it can not be activated -2 : Wrong activation key -3 : Profile found, but no user - database inconsistency?
public static activate ( $email, $key )
 /**
  * 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));
     }
 }