示例#1
0
 public function actionCreate()
 {
     $this->inputData['password'] = Security\Passwords::hash($this->inputData['password']);
     $this->inputData['role'] = self::$roles[0];
     if (isset($this->inputData['phone'])) {
         self::normalizePhone($this->inputData['phone']);
     }
     parent::actionCreate();
 }
示例#2
0
 /**
  * Adds new user.
  * @param  string
  * @param  string
  * @return void
  */
 public function add($username, $email, $password)
 {
     Passwords::validateNew($password);
     try {
         $this->db->table(static::TABLE_NAME)->insert(array(static::COLUMN_NAME => $username, static::COLUMN_EMAIL => $email, static::COLUMN_PASSWORD_HASH => Security\Passwords::hash($password)));
     } catch (Database\UniqueConstraintViolationException $e) {
         throw new DuplicateNameException();
     }
 }