Esempio n. 1
0
 /**
  * Sets password for the current user. The password is represented as a plain string which will
  * be hashed. The verification by {@link checkPasswordFormat} is performed beforehand. The UserException
  * will be raised in case of error.
  *
  * @param string the plain password to be hashed and set
  * @return null
  * @throws UserException in case of errors
  */
 function setPassword($plain_password)
 {
     if (!PasswordAuth::checkPasswordFormat($plain_password)) {
         throw new UserException("Incorret password parameter");
     }
     if ($this->id == self::GUEST) {
         throw new UserException("Cannot change password for guest user. Use User::add instead");
     }
     $this->hashed_password = PasswordAuth::hashPassword($this, $plain_password);
 }