Fixing API calls
This commit is contained in:
@@ -66,12 +66,11 @@ class AuthController extends Controller
|
||||
$user = User::findOne(['email' => $data['email'] ?? null]);
|
||||
if (!$user || !Yii::$app->security->validatePassword($data['password'], $user->password_hash)) {
|
||||
throw new UnauthorizedHttpException();
|
||||
return ['error' => 'Invalid credentials'];
|
||||
}
|
||||
// @todo not sure if it makes sense to generate an auth key each login via the API?
|
||||
$user->generateAuthKey();
|
||||
$user->save();
|
||||
|
||||
return ['token' => $this->generateJwt($user)];
|
||||
}e
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user