Code Duplication    Length = 5-5 lines in 2 locations

src/controllers/TotpController.php 2 locations

@@ 55-59 (lines=5) @@
52
    public function actionEnable($back = null)
53
    {
54
        $user = Yii::$app->user->identity;
55
        if ($user->totp_secret) {
56
            Yii::$app->session->setFlash('error', Yii::t('mfa', 'Two-factor authentication is already enabled. Disable first.'));
57
58
            return empty($back) ? $this->goHome() : $this->deferredRedirect($back);
59
        }
60
61
        $model = new InputForm();
62
        $secret = $this->module->getTotp()->getSecret();
@@ 72-76 (lines=5) @@
69
                    Yii::$app->session->setFlash('success', Yii::t('mfa', 'Two-factor authentication successfully enabled.'));
70
71
                    return empty($back) ? $this->goBack() : $this->deferredRedirect($back);
72
                } else {
73
                    Yii::$app->session->setFlash('error', Yii::t('mfa', 'Sorry, we have failed to enable two-factor authentication.'));
74
75
                    return empty($back) ? $this->goHome() : $this->deferredRedirect($back);
76
                }
77
            } else {
78
                $model->addError('code', Yii::t('mfa', 'Wrong verification code. Please verify your secret and try again.'));
79
            }