'ID', 'name' => 'Имя', 'login' => 'Логин', 'phone' => 'Телефон', 'website' => 'Личный сайт', 'accessToken' => '', 'passHash' => 'Пароль', ]; } /** * {@inheritDoc} */ public function fields() { return [ 'id', 'name', 'login', 'avatar', 'phone', 'website', 'accessToken' ]; } /** * {@inheritDoc} */ public static function tableName() { return "user"; } /** * {@inheritdoc} */ public static function findIdentity($id) { return self::findOne([ 'id' => $id ]); } /** * {@inheritdoc} */ public static function findIdentityByAccessToken($token, $type = null) { return self::findOne([ 'accessToken' => $token ]); } /** * Finds user by username * * @param string $username * @return static|null */ public static function findByUsername($username) { return self::findOne([ 'login' => $username ]); } /** * {@inheritdoc} */ public function getId() { return $this->id; } /** * {@inheritdoc} */ public function getAuthKey() { return $this->authKey; } /** * {@inheritdoc} */ public function validateAuthKey($authKey) { return $this->authKey === $authKey; } /** * Validates password * * @param string $password password to validate * @return bool if password provided is valid for current user */ public function validatePassword($password) { return Yii::$app->security->validatePassword($password, $this->passHash); } }