Code Duplication    Length = 11-12 lines in 2 locations

src/ForgotYourPasswordController.php 2 locations

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