Code Duplication    Length = 5-5 lines in 2 locations

src/controllers/TotpController.php 2 locations

@@ 83-87 (lines=5) @@
80
    {
81
        /** @var MfaIdentityInterface $user */
82
        $user = Yii::$app->user->identity;
83
        if ($user->getTotpSecret()) {
84
            Yii::$app->session->setFlash('error', Yii::t('mfa', 'Two-factor authentication is already enabled. Disable first.'));
85
86
            return empty($back) ? $this->goHome() : $this->deferredRedirect($back);
87
        }
88
89
        $model = new InputForm();
90
        $secret = $this->module->getTotp()->getSecret();
@@ 100-104 (lines=5) @@
97
                    Yii::$app->session->setFlash('success', Yii::t('mfa', 'Two-factor authentication successfully enabled.'));
98
99
                    return empty($back) ? $this->goBack() : $this->deferredRedirect($back);
100
                } else {
101
                    Yii::$app->session->setFlash('error', Yii::t('mfa', 'Sorry, we have failed to enable two-factor authentication.'));
102
103
                    return empty($back) ? $this->goHome() : $this->deferredRedirect($back);
104
                }
105
            } else {
106
                $model->addError('code', Yii::t('mfa', 'Wrong verification code. Please verify your secret and try again.'));
107
            }