Revision 49494
Added by Sofia Baltzi over 6 years ago
modules/dnet-openaire-users/trunk/src/main/java/eu/dnetlib/openaire/usermanagement/VerificationCodeServlet.java | ||
---|---|---|
39 | 39 |
String formUsername = request.getParameter("username"); |
40 | 40 |
String formVerificationCode = request.getParameter("verification_code"); |
41 | 41 |
|
42 |
if (verificationActions.verificationEntryExists(formUsername, formVerificationCode)) { |
|
43 |
//TODO check expiration date if "now" is more than 24h from the date in DB return error message
|
|
44 |
|
|
45 |
HttpSession session = request.getSession();
|
|
46 |
session.setAttribute("username", formUsername);
|
|
47 |
|
|
48 |
response.sendRedirect("./resetPassword.jsp");
|
|
49 |
printWriter.close();
|
|
50 |
|
|
42 |
if (verificationActions.verificationEntryExists(formUsername) && verificationActions.verificationCodeIsCorrect(formUsername, formVerificationCode)) {
|
|
43 |
if (!verificationActions.verificationCodeHasExpired(formUsername)) {
|
|
44 |
HttpSession session = request.getSession(); |
|
45 |
session.setAttribute("username", formUsername);
|
|
46 |
response.sendRedirect("./resetPassword.jsp");
|
|
47 |
} else { |
|
48 |
logger.info("Verification code has expired!");
|
|
49 |
response.sendRedirect("./expiredVerificationCode.jsp");
|
|
50 |
} |
|
51 | 51 |
} else { |
52 | 52 |
request.getSession().setAttribute("message", "Username or verification code are not valid."); |
53 | 53 |
response.sendRedirect("./verify.jsp"); |
54 |
// response.sendRedirect("./error.jsp"); or write a message in the session |
|
55 | 54 |
} |
55 |
printWriter.close(); |
|
56 | 56 |
|
57 | 57 |
} |
58 | 58 |
} |
Also available in: Unified diff
Work verification code expiration