Created
July 13, 2018 04:42
-
-
Save fatkulnurk/b5202a22acbd5d6a9e7eb77a1bd8da84 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* {@inheritdoc} | |
*/ | |
public static function findIdentity($id) | |
{ | |
return static::findOne($id); | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public static function findIdentityByAccessToken($token, $type = null) | |
{ | |
$result = static::findOne(['accessToke'=>$token]); | |
return new static($result); | |
} | |
/** | |
* Finds user by username | |
* | |
* @param string $username | |
* @return static|null | |
*/ | |
public static function findByUsername($username) | |
{ | |
$result = self::find()->where(['username'=>$username])->one(); | |
return new static($result); | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function getId() | |
{ | |
return $this->id; | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function getAuthKey() | |
{ | |
// return $this->authkey; | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function validateAuthKey($authKey) | |
{ | |
return $this->getAuthKey() === $authKey; | |
} | |
/** | |
* Validates password | |
* | |
* @param string $password password to validate | |
* @return bool if password provided is valid for current user | |
*/ | |
public function validatePassword($password) | |
{ | |
return $this->password == $password; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment