Covered all cases, fixed CS, added a new TODO

This commit is contained in:
ErickSkrauch
2020-06-13 01:55:02 +03:00
parent 0183e54442
commit 17f1794a4e
8 changed files with 35 additions and 17 deletions

View File

@ -62,14 +62,10 @@ class RefreshTokenForm extends ApiForm {
$account = Account::findOne(['id' => $tokenReader->getAccountId()]);
}
if ($account === null || $account->status === Account::STATUS_DELETED) {
if ($account === null) {
throw new ForbiddenOperationException('Invalid token.');
}
if ($account->status === Account::STATUS_BANNED) {
throw new ForbiddenOperationException('This account has been suspended.');
}
$token = Yii::$app->tokensFactory->createForMinecraftAccount($account, $this->clientToken);
// TODO: This behavior duplicates with the AuthenticationForm. Need to find a way to avoid duplication.