| @@ 61-65 (lines=5) @@ | ||
| 58 | { |
|
| 59 | /** @var MfaIdentityInterface $user */ |
|
| 60 | $user = Yii::$app->user->identity; |
|
| 61 | if ($user->getTotpSecret()) { |
|
| 62 | Yii::$app->session->setFlash( |
|
| 63 | 'error', |
|
| 64 | Yii::t('mfa', 'Two-factor authentication is already enabled. Disable first.') |
|
| 65 | ); |
|
| 66 | ||
| 67 | return empty($back) ? $this->goHome() : $this->deferredRedirect($back); |
|
| 68 | } |
|
| @@ 94-98 (lines=5) @@ | ||
| 91 | ); |
|
| 92 | ||
| 93 | return empty($back) ? $this->goBack() : $this->deferredRedirect($back); |
|
| 94 | } else { |
|
| 95 | Yii::$app->session->setFlash( |
|
| 96 | 'error', |
|
| 97 | Yii::t( |
|
| 98 | 'mfa', |
|
| 99 | 'Sorry, we have failed to enable two-factor authentication.' |
|
| 100 | ) |
|
| 101 | ); |
|