public function actionSendActivation($user_id)
 {
     /** @var $user User */
     /** @var $uv UserVerification */
     $user = User::model()->findByPk($user_id);
     switch ($user->user_group_id) {
         case Student::USER_GROUP_ID:
             $uv = UserVerification::model()->findByPk($user_id);
             if (!empty($uv)) {
                 $mailed = Emailer::emailStudentActivation($user, $uv->hash);
             }
             break;
         case Employer::USER_GROUP_ID:
             $mailed = Emailer::emailEmployerVerified($user);
             break;
         default:
             throw new CHttpException(404, 'Invalid user group.');
     }
     if (isset($mailed) && $mailed) {
         Yii::app()->user->setFlash('success', 'Activation Email sent to ' . CHtml::tag('strong', array(), $user->email));
     } else {
         Yii::app()->user->setFlash('error', 'Error occurred while sending email to ' . CHtml::tag('strong', array(), $user->email));
     }
     $this->redirect(array('admin'));
 }
 public function actionVerify($hash)
 {
     /** @var $verification UserVerification */
     $verification = UserVerification::model()->with('user')->findByAttributes(array('hash' => $hash));
     if (empty($verification)) {
         throw new CHttpException(404, 'Account cannot be found.');
     }
     $user = $verification->user;
     if ($user->verify()) {
         /*          $verification->delete();*/
         Yii::app()->user->setFlash('success', Yii::t('view', 'verified_lb'));
         $this->redirect(array('auth/login'));
         //$this->_loginNewUser($user->email, $user->password);
     }
 }