32], [['accessToken', 'authKey', 'password'], 'string', 'max' => 100], [['lang'], 'string', 'max' => 10], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id' => Yii::t('app', 'ID'), 'username' => Yii::t('app', 'Username'), 'forename' => Yii::t('app', 'Forename'), 'surname' => Yii::t('app', 'Surname'), 'email' => Yii::t('app', 'Email'), 'phone' => Yii::t('app', 'Phone'), 'lang' => Yii::t('app', 'Language'), 'accessToken' => Yii::t('app', 'Access Token'), 'authKey' => Yii::t('app', 'Auth Key'), 'password' => Yii::t('app', 'Password'), ]; } /** * @return string */ public function getAuthKey() { return $this->authKey; } /** * @return int */ public function getId() { return $this->id; } public function validateAuthKey($authKey){ return $this->authKey === $authKey; } public static function findIdentity($id){ return self::findOne($id); } public static function findIdentityByAccessToken($token, $type = null){ //throw new \yii\base\NotSupportedException(); return self::findOne(['access_token' => $token]); } public static function findByUsername($username){ return self::findOne(['username'=>$username]); } public function validatePassword($password){ return $this->password === $password; } /** * @param string $phone */ public function setPhone($phone) { $this->phone = $phone; } public function setEmail($email) { $this->email = $email; } /** * @return string */ public function getEmail() { return $this->email; } /** * @return string */ public function getPhone() { return $this->phone; } }