/** * Display reset password form. * * @param uuid the user uid */ public Result triggerResetPassword(final String uuid) { Form<ResetPasswordRequest> boundForm = passwordResetRequestForm.bindFromRequest(); if (boundForm.hasErrors()) { return badRequest(reset_password.render(uuid, boundForm)); } ResetPasswordRequest resetPasswordRequest = boundForm.get(); String decodedUuid = new String(Base64.decodeBase64(uuid)); if (!CaptchaManager.validateCaptcha(decodedUuid, resetPasswordRequest.captchaText)) { boundForm.reject("captchaText", Msg.get("captcha.error.wrong_word")); return badRequest(reset_password.render(uuid, boundForm)); } if (!getUserManagerController().resetUserPasswordFromEmail(resetPasswordRequest.mail, false)) { boundForm.reject("mail", Msg.get("authentication.standalone.reset.mail.unknown.message")); return badRequest(reset_password.render(uuid, boundForm)); } Utilities.sendSuccessFlashMessage(Msg.get("authentication.standalone.reset.success.message")); return redirect(controllers.dashboard.routes.DashboardController.index(0, false)); }