/
qwazarr
/
EducationalPractice
Обзор
Документация
Войти
/
qwazarr
/
EducationalPractice
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
models/User.php
77 строк
1 KB
qwazarr
'Расписание'
28 июн 2026, 17:12
28 июн 2026, 17:12
9d84635
Код
Авторство
О чём код?
<?php namespace app\models; use Yii; use yii\db\ActiveRecord; class User extends ActiveRecord implements \yii\web\IdentityInterface { /** * {@inheritdoc} */ public static function findIdentity($id) { return static::findOne($id); } /** * {@inheritdoc} */ public static function findIdentityByAccessToken($token, $type = null) { return static::findOne(['auth_key' => $token]); } /** * Finds user by username * * @param string $username * @return static|null */ public static function findByUsername($username) { return static::findOne(['username' => $username]); } /** * {@inheritdoc} */ public function getId() { return $this->id; } /** * {@inheritdoc} */ public function getAuthKey() { return $this->auth_key; } /** * {@inheritdoc} */ public function validateAuthKey($authKey) { return $this->auth_key === $authKey; } public function validatePassword($password) { return Yii::$app->security->validatePassword($password, $this->password_hash); } public function setPassword($password) { $this->password_hash = Yii::$app->security->generatePasswordHash($password); } public function generateAuthKey() { $this->auth_key = Yii::$app->security->generateRandomString(); } }