• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP UserModule类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: login

 public function login()
 {
     //前端传来的参数用quickInput()获取,不管是GET还是POST的,框架会自动过滤数据
     //$param = quickInput('userName');
     //因为暂时没有前台和数据库,这里模拟一下就好了
     $param = 'hello world';
     $server = new UserModule();
     echo $server->login($param);
 }
开发者ID:rolealiu,项目名称:RTP,代码行数:9,代码来源:UserController.class.php


示例2: actionSave

 public function actionSave()
 {
     $id = $_POST['id'];
     $ha = UserModule::model()->deleteAllByAttributes(array("user_level_id" => $id));
     $q = $_POST['q'];
     $arr = explode(";;", $q);
     $num = 1;
     foreach ($arr as $elem) {
         $ha = new UserModule();
         $ha->user_level_id = $id;
         $ha->module_id = $elem;
         $ha->save();
         $num++;
     }
 }
开发者ID:phpsong,项目名称:hotel-information-system,代码行数:15,代码来源:UserLevelController.php


示例3: actionConfirm

 public function actionConfirm()
 {
     if (!isset($_GET['email']) && !isset($_GET['key'])) {
         $this->redirect(array('index/index'));
     }
     switch (EmailVerification::model()->confirm($_GET['email'], $_GET['key'])) {
         case EmailVerification::CONFIRM_ALREADY_ACTIVE:
             echo UserModule::t('This email address has already been verified. Thank you!');
             break;
         case EmailVerification::CONFIRM_INVALID_KEY:
             echo UserModule::t('The confirmation key is invalid!');
             break;
         case EmailVerification::CONFIRM_KEY_NOT_ACTIVE:
             echo UserModule::t('This key is no longer active');
             break;
         case EmailVerification::CONFIRM_USER_BLOCKED:
             echo UserModule::t('This account is currently blocked');
             break;
         case EmailVerification::CONFIRM_SUCCESS:
             echo UserModule::t('This email is now verified. You can log in your account using this email. Thank you!');
             break;
         case EmailVerification::CONFIRM_ERROR:
         default:
             echo UserModule::t('Oops, an error has occurred! Please try again.');
     }
 }
开发者ID:redlaw,项目名称:lintinzone,代码行数:26,代码来源:RegistrationController.php


示例4: authenticate

 /**
  * Authenticates the password.
  * This is the 'authenticate' validator as declared in rules().
  */
 public function authenticate($attribute, $params)
 {
     if (!$this->hasErrors()) {
         $identity = new UserIdentity($this->username, $this->password);
         $identity->authenticate();
         switch ($identity->errorCode) {
             case UserIdentity::ERROR_NONE:
                 $duration = $this->rememberMe ? 3600 * 24 * 30 : 0;
                 // 30 days
                 Yii::app()->user->login($identity, $duration);
                 break;
             case UserIdentity::ERROR_EMAIL_INVALID:
                 $this->addError("username", UserModule::t("Email is incorrect."));
                 break;
             case UserIdentity::ERROR_USERNAME_INVALID:
                 $this->addError("username", UserModule::t("Username is incorrect. Please make sure you are using the secondary login details provided in your email"));
                 break;
             case UserIdentity::ERROR_STATUS_NOTACTIV:
                 $this->addError("status", UserModule::t("You account is not activated."));
                 break;
             case UserIdentity::ERROR_STATUS_BAN:
                 $this->addError("status", UserModule::t("You account is blocked."));
                 break;
             case UserIdentity::ERROR_PASSWORD_INVALID:
                 $this->addError("password", UserModule::t("Password is incorrect."));
                 break;
             case UserIdentity::ERROR_SERVER_ERROR:
                 $this->addError("status", UserModule::t("There is a server error. Please contact support"));
                 break;
             default:
                 $this->addError("status", UserModule::t("KUCH TO GADABAD HAI"));
                 break;
         }
     }
 }
开发者ID:sudeeptalati,项目名称:AmicaEngineerPortal,代码行数:39,代码来源:UserLogin.php


示例5: actionIndex

 public function actionIndex()
 {
     // Kiểm tra nếu đăng nhập rồi chuyển trang
     if (!Yii::app()->user->isGuest) {
         if (strpos(Yii::app()->user->returnUrl, '/index.php') !== false) {
             $this->redirect("/user/profile");
         } else {
             $this->redirect(Yii::app()->user->returnUrl);
         }
     }
     $model = new LoginForm();
     // if it is ajax validation request
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     // collect user input data
     if (isset($_POST['LoginForm'])) {
         $model->attributes = $_POST['LoginForm'];
         // validate user input and redirect to the previous page if valid
         if ($model->validate() && $model->login()) {
             $this->setRedirectOptions(array("title" => UserModule::t('Login Success'), "message" => UserModule::t('The login was successful!')));
             if (strpos(Yii::app()->user->returnUrl, '/index.php') !== false) {
                 $this->redirect("/user/profile");
             } else {
                 $this->redirect(Yii::app()->user->returnUrl);
             }
         }
     }
     $this->render('index', array('model' => $model));
 }
开发者ID:qkongvan,项目名称:k6-thuc-pham,代码行数:31,代码来源:LoginController.php


示例6: actionChangepassword

 /**
  * Change password
  */
 public function actionChangepassword()
 {
     $model = new UserChangePassword();
     if (Yii::app()->user->id) {
         // ajax validator
         if (isset($_POST['ajax']) && $_POST['ajax'] === 'changepassword-form') {
             echo UActiveForm::validate($model);
             Yii::app()->end();
         }
         if (isset($_POST['UserChangePassword'])) {
             $model->attributes = $_POST['UserChangePassword'];
             if ($model->validate()) {
                 $new_password = User::model()->notsafe()->findbyPk(Yii::app()->user->id);
                 $new_password->password = UserModule::encrypting($model->password);
                 $new_password->activkey = UserModule::encrypting(microtime() . $model->password);
                 $new_password->save();
                 ///ALSO SAVE PASS oN SERVER
                 $u = User::model()->findByAttributes(array('password' => $new_password->password));
                 $rm_msg = $model->remoteupdatepass($u->email, $new_password->password);
                 Yii::app()->user->setFlash('profileMessage', UserModule::t("New password is saved " . $rm_msg));
                 $this->redirect(array("profile"));
             }
         }
         $this->render('changepassword', array('model' => $model));
     }
 }
开发者ID:sudeeptalati,项目名称:AmicaEngineerPortal,代码行数:29,代码来源:ProfileController.php


示例7: authenticate

 /**
  * Authenticates the password.
  * This is the 'authenticate' validator as declared in rules().
  * returning true false does not stops proceeding to action. to stop add error to attribute.
  */
 public function authenticate($attribute, $params)
 {
     if (!$this->hasErrors()) {
         $this->_identity = new UserIdentity($this->username, $this->password);
         $this->_identity->authenticate();
         switch ($this->_identity->errorCode) {
             case UserIdentity::ERROR_NONE:
                 $duration = $this->rememberMe ? Yii::app()->controller->module->rememberMeTime : 0;
                 Yii::app()->user->login($this->_identity, $duration);
                 AppCommon::mergeCookieAndDbCart();
                 //on login merge the db and cookie carts
                 break;
             case UserIdentity::ERROR_EMAIL_INVALID:
                 $this->addError("username", UserModule::t("Email is incorrect."));
                 break;
             case UserIdentity::ERROR_STATUS_NOTACTIV:
                 $this->addError("username", UserModule::t("You account is not activated."));
                 break;
             case UserIdentity::ERROR_STATUS_BAN:
                 $this->addError("username", UserModule::t("You account is blocked."));
                 break;
             case UserIdentity::ERROR_PASSWORD_INVALID:
                 $this->addError("password", UserModule::t("Password is incorrect."));
                 break;
         }
         if ($this->_identity->errorCode === UserIdentity::ERROR_NONE) {
             return true;
         } else {
             return false;
         }
     }
 }
开发者ID:ankitbishtkec,项目名称:generic-ecommerce-website,代码行数:37,代码来源:LoginForm.php


示例8: actionActivation

 /**
  * Activation user account
  */
 public function actionActivation()
 {
     $email = $_GET['email'];
     $activkey = $_GET['activkey'];
     if ($email && $activkey) {
         $find = User::model()->notsafe()->findByAttributes(array('email' => $email));
         if (isset($find) && $find->status) {
             $this->autoLogin($find->username);
             // update user_id in invite table
             Invite::model()->updateNewUser($find);
             // account already active
             Yii::app()->user->setFlash('success', 'Congratulations! Your account is now active. Please follow the directions below to set up your location.');
             $this->redirect('/userlocation/locate');
             //			    $this->render('/user/message',array('title'=>UserModule::t("User activation"),'content'=>UserModule::t("Your account is active.")));
         } elseif (isset($find->activkey) && $find->activkey == $activkey) {
             $find->activkey = UserModule::encrypting(microtime());
             $find->status = 1;
             $find->save();
             $this->autoLogin($find->username);
             // direct to autolocate with activation message
             Yii::app()->user->setFlash('success', 'Congratulations! Your account is now active. Please follow the directions below to set up your location.');
             $this->redirect('/userlocation/locate');
             // $this->render('/user/message',array('title'=>UserModule::t("User activation"),'content'=>UserModule::t("Your account is activated.")));
         } else {
             $this->render('/user/message', array('title' => UserModule::t("User activation"), 'content' => UserModule::t("Incorrect activation URL. Please email [email protected] if you need assistance.")));
         }
     } else {
         $this->render('/user/message', array('title' => UserModule::t("User activation"), 'content' => UserModule::t("Incorrect activation URL. Please email [email protected] if you need assistance.")));
     }
 }
开发者ID:mafiu,项目名称:listapp,代码行数:33,代码来源:ActivationController.php


示例9: authenticate

 /**
  * Authenticates the password.
  * This is the 'authenticate' validator as declared in rules().
  */
 public function authenticate($attribute, $params)
 {
     if (!$this->hasErrors()) {
         $identity = new UserIdentity($this->username, $this->password);
         $identity->authenticate();
         switch ($identity->errorCode) {
             case UserIdentity::ERROR_NONE:
                 $duration = $this->rememberMe ? Yii::app()->controller->module->rememberMeTime : 0;
                 Yii::app()->user->login($identity, $duration);
                 break;
             case UserIdentity::ERROR_EMAIL_INVALID:
                 $this->addError("username", UserModule::t("Correo incorrecto"));
                 break;
             case UserIdentity::ERROR_USERNAME_INVALID:
                 $this->addError("username", UserModule::t("Nombre de usuario incorrecto"));
                 break;
             case UserIdentity::ERROR_STATUS_NOTACTIV:
                 $this->addError("status", UserModule::t("Su cuenta no está activada"));
                 break;
             case UserIdentity::ERROR_STATUS_BAN:
                 $this->addError("status", UserModule::t("Su cuenta ha sido blockeada"));
                 break;
             case UserIdentity::ERROR_PASSWORD_INVALID:
                 $this->addError("password", UserModule::t("Contraseña incorrecta"));
                 break;
         }
     }
 }
开发者ID:alsvader,项目名称:hackbanero,代码行数:32,代码来源:UserLogin.php


示例10: getDefaultPicture

 /**
  * Gets the default profile picture for a specifc user.
  * @param string $userId The Id of the user to get profile picture. If this is empty, the current user's avatar will be returned.
  * @param string $type The type of picture to return (original, thumb.profile, thumb.feed, thumb.icon)
  * @return array The picture info (path, alt, title, width, height)
  */
 public static function getDefaultPicture($userId = '', $type = 'original')
 {
     if (empty($userId)) {
         $userId = Yii::app()->user->getId();
         if (empty($userId)) {
             return null;
         }
     }
     // Detect user's gender to decide which avatar should be chosen
     $gender = Profile::model()->getFieldInfo($userId, User::PREFIX, 'gender');
     if ($gender['value'] === 'male') {
         $info['path'] = Yii::app()->getBaseUrl(true) . '/files/images/default-avatar-male.jpg';
     } else {
         $info['path'] = Yii::app()->getBaseUrl(true) . '/files/images/default-avatar-female.jpg';
     }
     // Alt and title
     $info['alt'] = $info['title'] = UserModule::t('Default Avatar');
     // Get size
     //Yii::app()->getModule('system'); // Get module 'system'
     $photoTypes = Setting::model()->get('photo_types', array('value'));
     /*var_dump($photoTypes->value);
     		var_dump($photoTypes['value']); die;*/
     $photoTypes = json_decode($photoTypes['value'], true);
     // true indicates that the object will be converted to associative arrays
     if (!isset($photoTypes[$type])) {
         $info['width'] = 160;
         $info['height'] = 160;
     } else {
         $info['width'] = $photoTypes[$type]['width'];
         $info['height'] = $photoTypes[$type]['height'];
     }
     return $info;
 }
开发者ID:redlaw,项目名称:lintinzone,代码行数:39,代码来源:ProfilePicture.php


示例11: authenticate

 /**
  * Authenticates the user's credentials.
  * @return true|false
  */
 public function authenticate($attribute, $params)
 {
     // Ensure the input to be authenticated is valid.
     if (!$this->hasErrors()) {
         $identity = new UserIdentity($this->username, $this->password);
         $identity->authenticate();
         switch ($identity->errorCode) {
             case UserIdentity::ERROR_NONE:
                 //$duration = $this->rememberMe ? 3600 * 24 * 30 : 0;
                 $duration = 0;
                 Yii::app()->user->login($identity, $duration);
                 return true;
             case UserIdentity::ERROR_EMAIL_INVALID:
             case UserIdentity::ERROR_USERNAME_INVALID:
             case UserIdentity::ERROR_PASSWORD_INVALID:
                 Yii::trace('Error codeeee: ' . $identity->errorCode, 'system.db.ar.CActiveRecord');
                 $this->addError('username', UserModule::t('Incorrect username or password.'));
                 return false;
             case UserIdentity::ERROR_STATUS_NOTACTIVE:
                 $this->addError('active', UserModule::t('Your account is not activated yet. Make sure you confirm your email address before logging in.'));
                 return false;
             case UserIdentity::ERROR_STATUS_BLOCKED:
                 $this->addError('blocked', UserModule::t('Your account is blocked.'));
                 return false;
         }
     }
 }
开发者ID:redlaw,项目名称:lintinzone,代码行数:31,代码来源:Login.php


示例12: actionChangepassword

	/**
	 * Change password
	 */
	public function actionChangepassword() {
		$model = new UserChangePassword;
		if (Yii::app()->user->id) {
			
			// ajax validator
			if(isset($_POST['ajax']) && $_POST['ajax']==='changepassword-form')
			{
				echo UActiveForm::validate($model);
				Yii::app()->end();
			}
			
			if(isset($_POST['UserChangePassword'])) {
					$model->attributes=$_POST['UserChangePassword'];
					if($model->validate()) {
						$new_password = User::model()->notsafe()->findbyPk(Yii::app()->user->id);
						$new_password->password = UserModule::encrypting($model->password);
						$new_password->activkey=UserModule::encrypting(microtime().$model->password);
						$new_password->save();
						Yii::app()->user->setFlash('success',UserModule::t("New password is saved."));
						$this->redirect(array("profile"));
					}
			}
			$this->render('changepassword',array('model'=>$model));
	    }
	}
开发者ID:alsvader,项目名称:hackbanero,代码行数:28,代码来源:ProfileController.php


示例13: actionActivation

 /**
  * Activation user account
  */
 public function actionActivation()
 {
     $email = $_GET['email'];
     $activkey = $_GET['activkey'];
     $view = '/user/message';
     if (isset($this->location)) {
         $view = 'frontend.views.user.message';
     }
     if ($email && $activkey) {
         $find = User::model()->notsafe()->findByAttributes(array('email' => $email));
         if (isset($find) && $find->status) {
             $this->render($view, array('title' => UserModule::t("User activation"), 'content' => UserModule::t("Your account is active.")));
         } elseif (isset($find->activkey) && $find->activkey == $activkey) {
             $find->activkey = PasswordHelper::hashPassword(microtime());
             $find->status = 1;
             $find->save();
             //$this->render('/user/message',array('title'=>UserModule::t("User activation"),'content'=>UserModule::t("You account is activated.")));
             Yii::app()->user->setFlash('activateMessage', UserModule::t("Your account has been activated."));
             $this->redirect(Yii::app()->controller->module->loginUrl);
         } else {
             $this->render($view, array('title' => UserModule::t("User activation"), 'content' => UserModule::t("Incorrect activation URL.")));
         }
     } else {
         $this->render($view, array('title' => UserModule::t("User activation"), 'content' => UserModule::t("Incorrect activation URL.")));
     }
 }
开发者ID:Rudianasaja,项目名称:cycommerce,代码行数:29,代码来源:ActivationController.php


示例14: actionChangepassword

 /**
  * Change password
  */
 public function actionChangepassword()
 {
     $model = new UserChangePassword();
     if (Yii::app()->user->id) {
         //$phis = new PasswordHistory();
         //$passes = $phis->getHistory(Yii::app()->user->id);
         //CVarDumper::dump($passes);
         // ajax validator
         if (isset($_POST['ajax']) && $_POST['ajax'] === 'changepassword-form') {
             echo UActiveForm::validate($model);
             Yii::app()->end();
         }
         if (isset($_POST['UserChangePassword'])) {
             $model->attributes = $_POST['UserChangePassword'];
             if ($model->validate()) {
                 $new_password = User::model()->notsafe()->findbyPk(Yii::app()->user->id);
                 $new_password->password = PasswordHelper::hashPassword($model->password);
                 $new_password->activkey = PasswordHelper::hashPassword(microtime() . $model->password);
                 $new_password->password_update_time = date('Y-m-d H:i:s');
                 $new_password->save();
                 $passwordHistory = new PasswordHistory();
                 $passwordHistory->profile_id = $new_password->id;
                 $passwordHistory->password = $new_password->password;
                 $passwordHistory->save();
                 Yii::app()->user->setFlash('profileMessage', UserModule::t("New password is saved."));
                 $this->redirect(array("profile"));
             }
         }
         if (isset($this->location)) {
             $this->render('frontend.views.profile.changepassword', array('model' => $model));
         } else {
             $this->render('changepassword', array('model' => $model));
         }
     }
 }
开发者ID:Rudianasaja,项目名称:cycommerce,代码行数:38,代码来源:ProfileController.php


示例15: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new User();
     $profile = new Profile();
     $this->performAjaxValidation(array($model, $profile));
     if (isset($_POST['User'])) {
         $model->attributes = $_POST['User'];
         $password = $_POST['User']['password'];
         $model->activkey = Yii::app()->controller->module->encrypting(microtime() . $model->password);
         $profile->attributes = $_POST['Profile'];
         $profile->user_id = 0;
         if ($model->validate() && $profile->validate()) {
             $model->password = Yii::app()->controller->module->encrypting($model->password);
             if ($model->save()) {
                 //send mail
                 UserModule::sendMail($model->email, UserModule::t("You are registered from {site_name}", array('{site_name}' => Yii::app()->name)), UserModule::t("Please login to your account with your email id as username and password {password}", array('{password}' => $password)));
                 $profile->user_id = $model->id;
                 $profile->save();
             }
             $this->redirect(array('/rights/assignment/user', 'id' => $model->id));
         } else {
             $profile->validate();
         }
     }
     $this->render('create', array('model' => $model, 'profile' => $profile));
 }
开发者ID:akilraj1255,项目名称:rajeshwari,代码行数:30,代码来源:AdminController.php


示例16: authenticate

 /**
  * Authenticates a user.
  * The example implementation makes sure if the username and password
  * are both 'demo'.
  * In practical applications, this should be changed to authenticate
  * against some persistent user identity storage (e.g. database).
  * @return boolean whether authentication succeeds.
  */
 public function authenticate()
 {
     if (strpos($this->username, "@")) {
         $user = User::model()->notsafe()->findByAttributes(array('email' => $this->username));
     } else {
         $user = User::model()->notsafe()->findByAttributes(array('username' => $this->username));
     }
     if ($user === null) {
         if (strpos($this->username, "@")) {
             $this->errorCode = self::ERROR_EMAIL_INVALID;
         } else {
             $this->errorCode = self::ERROR_USERNAME_INVALID;
         }
     } else {
         if (UserModule::encrypting($this->password) !== $user->password) {
             $this->errorCode = self::ERROR_PASSWORD_INVALID;
         } else {
             if ($user->status == 0) {
                 $this->errorCode = self::ERROR_STATUS_NOTACTIV;
             } else {
                 if ($user->status == -1) {
                     $this->errorCode = self::ERROR_STATUS_BAN;
                 } else {
                     $this->_id = $user->id;
                     if (!$this->username) {
                         $this->username = $user->username;
                     }
                     $this->errorCode = self::ERROR_NONE;
                 }
             }
         }
     }
     return !$this->errorCode;
 }
开发者ID:kosenka,项目名称:yboard,代码行数:42,代码来源:UserIdentity.php


示例17: actionActivation

	/**
	 * Activation user account
	 */
	public function actionActivation () {
		$email = $_GET['email'];
		$activkey = $_GET['activkey'];
		if ($email&&$activkey) {
			$find = User::model()->notsafe()->findByAttributes(array('email'=>$email));
			if (isset($find)&&$find->status) {
			    $this->render('/user/message',array('title'=>UserModule::t("User activation"),'content'=>UserModule::t("You account is active.")));
			} elseif(isset($find->activkey) && ($find->activkey==$activkey)) {
				$find->activkey = UserModule::encrypting(microtime());
				$find->status = 1;
				$find->save();
                if (!Yii::app()->controller->module->autoLogin) {
                    $this->render('/user/message',array('title'=>UserModule::t("User activation"),'content'=>UserModule::t("You account is activated.")));
                } else {
                    $identity=new UserIdentity($find->username, '');
                    $identity->authenticate(true);
                    Yii::app()->user->login($identity,0);
                    Yii::app()->user->setFlash('userActivationSuccess', UserModule::t("You account is activated."));
                    $this->redirect(Yii::app()->controller->module->returnUrl);
                }
			} else {
			    $this->render('/user/message',array('title'=>UserModule::t("User activation"),'content'=>UserModule::t("Incorrect activation URL.")));
			}
		} else {
			$this->render('/user/message',array('title'=>UserModule::t("User activation"),'content'=>UserModule::t("Incorrect activation URL.")));
		}
	}
开发者ID:rallin,项目名称:yii-user,代码行数:30,代码来源:ActivationController.php


示例18: verifyOldPassword

 /**
  * Verify Old Password
  */
 public function verifyOldPassword($attribute, $params)
 {
     $password = User::model()->notsafe()->findByPk(Yii::app()->user->id)->password;
     if ($password != Yii::app()->getModule('user')->encrypting($this->{$attribute}, $password)) {
         $this->addError($attribute, UserModule::t("Old Password is incorrect."));
     }
 }
开发者ID:alsvader,项目名称:hackbanero,代码行数:10,代码来源:UserChangePassword.php


示例19: actionChangepassword

 /**
  * Change password
  */
 public function actionChangepassword()
 {
     if (isAdmin()) {
         $this->layout = '//layouts/main';
     }
     $model = new UserChangePassword();
     if (Yii::app()->user->id) {
         // ajax validator
         if (isset($_POST['ajax']) && $_POST['ajax'] === 'changepassword-form') {
             echo UActiveForm::validate($model);
             Yii::app()->end();
         }
         if (isset($_POST['UserChangePassword'])) {
             $model->attributes = $_POST['UserChangePassword'];
             if ($model->validate()) {
                 //$new_password = User::model()->notsafe()->findbyPk(Yii::app()->user->id);
                 $new_password = User::model()->findbyPk(Yii::app()->user->id);
                 $new_password->password = UserModule::encrypting($model->password);
                 $new_password->activkey = UserModule::encrypting(microtime() . $model->password);
                 if ($new_password->save()) {
                     Yii::app()->user->setFlash('success', UserModule::t("Thay đổi mật khẩu thành công"));
                     $this->redirect(array("profile"));
                 } else {
                     Yii::app()->user->setFlash('error', UserModule::t("Thay đổi mật khẩu không thành công"));
                 }
             }
         }
         $this->render('changepassword', array('model' => $model));
     }
 }
开发者ID:phiphi1992,项目名称:fpthue,代码行数:33,代码来源:ProfileController.php


示例20: actionActivation

 /**
  * Activation d'un compte utilisateur. En principe on arrive ici avec une url d'activation
  * qui a été fournie par mail à l'utilisateur
  */
 public function actionActivation()
 {
     $email = trim($_GET['email']);
     $activkey = trim($_GET['activkey']);
     if ($email && $activkey) {
         /** @var User $user */
         $user = User::model()->findByAttributes(array('email' => $email));
         if (isset($user) && $user->status) {
             // compte déjà activé
             $this->render('/user/message', array('title' => Yii::t("UserModule.user", "User activation"), 'content' => Yii::t("UserModule.msg", "Your account is already active")));
         } elseif (isset($user) && isset($user->activkey) && $user->activkey == $activkey) {
             // on enregistre une nouvelle clé d'activation pour éviter une activation parasite sur ce compte par la suite
             $user->activkey = UserModule::encrypting(microtime());
             // activation du compte
             $user->status = 1;
             if (!$user->save()) {
                 $this->render('/user/message', array('title' => Yii::t("UserModule.user", "User activation"), 'content' => Yii::t("UserModule.msg", "The activation has failed. Please contact the administrator")));
             } else {
                 $this->render('/user/message', array('title' => Yii::t("UserModule.user", "User activation"), 'content' => Yii::t("UserModule.msg", "Your account has been successfully activated")));
             }
         } else {
             // erreur : utilisateur inconnu, clé d'activation incorrecte...
             $this->render('/user/message', array('title' => Yii::t("UserModule.user", "User activation"), 'content' => Yii::t("UserModule.msg", "Incorrect activation URL")));
         }
     } else {
         // erreur sur les paramètres du $_GET
         $this->render('/user/message', array('title' => Yii::t("UserModule.user", "User activation"), 'content' => Yii::t("UserModule.msg", "Incorrect activation URL")));
     }
 }
开发者ID:ChristopheBrun,项目名称:hLib,代码行数:33,代码来源:ActivationController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP UserPeer类代码示例发布时间:2022-05-23
下一篇:
PHP UserModel类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap