Esempio n. 1
0
 /**
  * Signs user with given credentials
  * @return string|null Either JWT either null if user is not saved
  * @throws \yii\web\ServerErrorHttpException If getJWT method is missing in
  *         									 User model
  */
 public function auth()
 {
     $user = User::findByUsername($this->username);
     if ($user && $user->validatePassword($this->password)) {
         return $user->jwt;
     }
     return null;
 }