Code Duplication    Length = 11-12 lines in 2 locations

src/ForgotYourPasswordController.php 2 locations

@@ 283-294 (lines=12) @@
280
            }
281
        }
282
283
        if ($password !== $confirmpassword) {
284
            if ($this->isJson($request)) {
285
                return new JsonResponse([
286
                    'error' => 'Mismatching passwords',
287
                ], 400);
288
            } else {
289
                $view = new ResetPasswordView($token, $this->passwordStrengthCheck->getPasswordRules());
290
                $this->content->addHtmlElement($view->withDisplayMismatchPassword());
291
292
                return new HtmlResponse($this->template, 400);
293
            }
294
        }
295
296
        if ($this->passwordStrengthCheck->checkPasswordStrength($password) === false) {
297
            if ($this->isJson($request)) {
@@ 297-307 (lines=11) @@
294
        }
295
296
        if ($this->passwordStrengthCheck->checkPasswordStrength($password) === false) {
297
            if ($this->isJson($request)) {
298
                return new JsonResponse([
299
                    'error' => 'Password strength too weak',
300
                    'rules' => $this->passwordStrengthCheck->getPasswordRules(),
301
                ], 400);
302
            } else {
303
                $view = new ResetPasswordView($token, $this->passwordStrengthCheck->getPasswordRules());
304
                $this->content->addHtmlElement($view->withDisplayPoorPassword());
305
306
                return new HtmlResponse($this->template, 400);
307
            }
308
        }
309
310
        $this->forgotYourPasswordService->useToken($token, $password);