Fix redirect when user does not exist
This commit is contained in:
parent
12816439bd
commit
e3395073ab
|
@ -56,7 +56,7 @@ public class ForgotPasswordServlet extends HttpServlet {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
String username = ldapActions.getUsername(formEmail);
|
String username = ldapActions.getUsername(formEmail);
|
||||||
if (username == null) {
|
if (username == null || username.isEmpty()) {
|
||||||
request.getSession().setAttribute("message", "User does not exist.");
|
request.getSession().setAttribute("message", "User does not exist.");
|
||||||
response.sendRedirect("./forgotPassword.jsp");
|
response.sendRedirect("./forgotPassword.jsp");
|
||||||
|
|
||||||
|
@ -84,6 +84,9 @@ public class ForgotPasswordServlet extends HttpServlet {
|
||||||
String verificationCodeSubject = "Your OpenAIRE password reset request";
|
String verificationCodeSubject = "Your OpenAIRE password reset request";
|
||||||
|
|
||||||
emailSender.sendEmail(formEmail, verificationCodeSubject, verificationCodeMsg);
|
emailSender.sendEmail(formEmail, verificationCodeSubject, verificationCodeMsg);
|
||||||
|
|
||||||
|
response.setContentType("text/html");
|
||||||
|
response.sendRedirect("./verify.jsp");
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (LDAPException ldape) {
|
} catch (LDAPException ldape) {
|
||||||
|
@ -95,8 +98,6 @@ public class ForgotPasswordServlet extends HttpServlet {
|
||||||
response.sendRedirect("./forgotPassword.jsp");
|
response.sendRedirect("./forgotPassword.jsp");
|
||||||
}
|
}
|
||||||
|
|
||||||
response.setContentType("text/html");
|
|
||||||
response.sendRedirect("./verify.jsp");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue