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