Revision 51775
Added by Sofia Baltzi almost 6 years ago
ForgotPasswordServlet.java | ||
---|---|---|
86 | 86 |
} else { |
87 | 87 |
UUID verificationCode = UUID.randomUUID(); |
88 | 88 |
Date creationDate = new Date(); |
89 |
String vCode = verificationCode.toString(); |
|
89 | 90 |
|
90 | 91 |
Timestamp timestamp = new Timestamp(creationDate.getTime()); |
91 | 92 |
|
92 | 93 |
if (!verificationActions.verificationEntryExists(username)) { |
93 |
verificationActions.addVerificationEntry(username, verificationCode.toString(), timestamp);
|
|
94 |
verificationActions.addVerificationEntry(username, vCode, timestamp);
|
|
94 | 95 |
|
95 | 96 |
} else { |
96 |
verificationActions.updateVerificationEntry(username, verificationCode.toString(), timestamp);
|
|
97 |
verificationActions.updateVerificationEntry(username, vCode, timestamp);
|
|
97 | 98 |
} |
98 | 99 |
|
99 | 100 |
String resultPath = UrlConstructor.getRedirectUrl(request, "verify.jsp"); |
101 |
String resultPathWithVCode = UrlConstructor.getVerificationLink(resultPath, vCode); |
|
100 | 102 |
|
101 | 103 |
String verificationCodeMsg = "<p>Hello,</p>" + |
102 | 104 |
"<p> A request has been made to reset your OpenAIRE account password. To reset your " + |
103 | 105 |
"password, you will need to submit this verification code in order to verify that the " + |
104 | 106 |
"request was legitimate.</p>" + |
105 |
"<p> The verification code is " + verificationCode.toString() + "</p>" +
|
|
107 |
"<p> The verification code is " + vCode + "</p>" +
|
|
106 | 108 |
"Click the URL below and proceed with verification." + |
107 |
"<p><a href=" + resultPath + ">" + resultPath + "</a></p>" +
|
|
109 |
"<p><a href=" + resultPathWithVCode + ">" + resultPathWithVCode + "</a></p>" +
|
|
108 | 110 |
"<p>Thank you</p>"; |
109 | 111 |
|
110 | 112 |
String verificationCodeSubject = "Your OpenAIRE password reset request"; |
Also available in: Unified diff
Add verificationCode in email's verificationLink for registration and forgot password