mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Fixes ACCOUNTS-2. Catch decryption exception for OAuth2 flow
This commit is contained in:
@@ -3,6 +3,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace api\components\OAuth2;
|
||||
|
||||
use LogicException;
|
||||
use RangeException;
|
||||
use SodiumException;
|
||||
use Yii;
|
||||
|
||||
/**
|
||||
@@ -20,7 +23,11 @@ trait CryptTrait {
|
||||
}
|
||||
|
||||
protected function decrypt($encryptedData): string {
|
||||
return Yii::$app->tokens->decryptValue($encryptedData);
|
||||
try {
|
||||
return Yii::$app->tokens->decryptValue($encryptedData);
|
||||
} catch (SodiumException | RangeException $e) {
|
||||
throw new LogicException($e->getMessage(), 0, $e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user