Revision 49199
Added by Katerina Iatropoulou over 6 years ago
modules/dnet-openaire-users/trunk/src/main/java/eu/dnetlib/openaire/usermanagement/VerificationCodeServlet.java | ||
---|---|---|
35 | 35 |
String formVerificationCode = request.getParameter("verification_code"); |
36 | 36 |
|
37 | 37 |
if (verificationActions.verificationEntryExists(formUsername, formVerificationCode)) { |
38 |
//TODO check expiration date if "now" is more than 24h from the date in DB return error message |
|
39 |
//else go to next step resetPassword.jsp |
|
38 | 40 |
response.sendRedirect("./resetPassword.jsp"); |
41 |
printWriter.close(); |
|
39 | 42 |
|
40 | 43 |
} else { |
41 |
response.sendRedirect("./error.jsp");
|
|
44 |
// response.sendRedirect("./error.jsp"); or write a message in the session
|
|
42 | 45 |
} |
43 | 46 |
|
44 |
response.sendRedirect("./resetPassword.jsp"); |
|
45 |
printWriter.close(); |
|
46 | 47 |
} |
47 | 48 |
} |
modules/dnet-openaire-users/trunk/src/main/java/eu/dnetlib/openaire/usermanagement/RemindUsernameServlet.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.openaire.usermanagement; |
2 | 2 |
|
3 | 3 |
import com.unboundid.ldap.sdk.LDAPException; |
4 |
import eu.dnetlib.openaire.user.utils.EmailActions; |
|
5 | 4 |
import eu.dnetlib.openaire.user.utils.LDAPActions; |
6 | 5 |
import org.apache.log4j.Logger; |
7 | 6 |
import org.springframework.beans.factory.annotation.Autowired; |
... | ... | |
30 | 29 |
@Autowired |
31 | 30 |
private LDAPActions ldapActions; |
32 | 31 |
|
33 |
private EmailActions emailActions; |
|
32 |
//private EmailActions emailActions;
|
|
34 | 33 |
|
35 | 34 |
private Logger logger = Logger.getLogger(RemindUsernameServlet.class); |
36 | 35 |
|
modules/dnet-openaire-users/trunk/src/main/java/eu/dnetlib/openaire/usermanagement/ForgotPasswordServlet.java | ||
---|---|---|
50 | 50 |
} |
51 | 51 |
|
52 | 52 |
try { |
53 |
String userEmail = ldapActions.getUsername(formEmail);
|
|
53 |
String username = ldapActions.getUsername(formEmail);
|
|
54 | 54 |
|
55 |
if (userEmail == null) {
|
|
55 |
if (username == null) {
|
|
56 | 56 |
request.getSession().setAttribute("message", "User does not exist."); |
57 | 57 |
response.sendRedirect("./forgotPassword.jsp"); |
58 | 58 |
|
59 | 59 |
} else { |
60 |
String username = ldapActions.getUsername(userEmail); |
|
61 | 60 |
UUID verificationCode = UUID.randomUUID(); |
62 | 61 |
Date creationDate = new Date(); |
63 | 62 |
|
... | ... | |
68 | 67 |
verificationActions.updateVerificationEntry(username, verificationCode.toString(), creationDate); |
69 | 68 |
} |
70 | 69 |
|
71 |
emailActions.sendVerificationCode(userEmail);
|
|
70 |
emailActions.sendVerificationCode(formEmail);
|
|
72 | 71 |
|
73 | 72 |
} |
74 | 73 |
|
modules/dnet-openaire-users/trunk/src/main/webapp/forgotPassword.jsp | ||
---|---|---|
53 | 53 |
<div class="alert alert-success" aria-hidden="true" style="display: none;"></div> |
54 | 54 |
<div class="alert alert-danger" aria-hidden="true" style="display: none;"></div> |
55 | 55 |
<div class="form-group"> |
56 |
<span id="server_error" class="uk-text-danger uk-text-small uk-float-left">${message}</span>
|
|
56 |
<span id="server_error" class="uk-text-danger uk-text-small uk-float-left">${message}</span> |
|
57 | 57 |
<c:remove var="message" scope="session" /> |
58 | 58 |
<span class="msg_email_error uk-text-danger uk-text-small uk-float-left" style="display:none">Please enter your email.</span> |
59 | 59 |
<span class="msg_email_validation_error uk-text-danger uk-text-small uk-float-left" style="display:none">Please enter a valid email.</span> |
Also available in: Unified diff
minor cahnges