minor cahnges

This commit is contained in:
Katerina Iatropoulou 2017-10-02 14:59:37 +00:00
parent 6aa55c08c7
commit 2272f14978
4 changed files with 9 additions and 10 deletions

View File

@ -50,14 +50,13 @@ public class ForgotPasswordServlet extends HttpServlet {
} }
try { try {
String userEmail = ldapActions.getUsername(formEmail); String username = ldapActions.getUsername(formEmail);
if (userEmail == null) { if (username == null) {
request.getSession().setAttribute("message", "User does not exist."); request.getSession().setAttribute("message", "User does not exist.");
response.sendRedirect("./forgotPassword.jsp"); response.sendRedirect("./forgotPassword.jsp");
} else { } else {
String username = ldapActions.getUsername(userEmail);
UUID verificationCode = UUID.randomUUID(); UUID verificationCode = UUID.randomUUID();
Date creationDate = new Date(); Date creationDate = new Date();
@ -68,7 +67,7 @@ public class ForgotPasswordServlet extends HttpServlet {
verificationActions.updateVerificationEntry(username, verificationCode.toString(), creationDate); verificationActions.updateVerificationEntry(username, verificationCode.toString(), creationDate);
} }
emailActions.sendVerificationCode(userEmail); emailActions.sendVerificationCode(formEmail);
} }

View File

@ -1,7 +1,6 @@
package eu.dnetlib.openaire.usermanagement; package eu.dnetlib.openaire.usermanagement;
import com.unboundid.ldap.sdk.LDAPException; import com.unboundid.ldap.sdk.LDAPException;
import eu.dnetlib.openaire.user.utils.EmailActions;
import eu.dnetlib.openaire.user.utils.LDAPActions; import eu.dnetlib.openaire.user.utils.LDAPActions;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -30,7 +29,7 @@ public class RemindUsernameServlet extends HttpServlet {
@Autowired @Autowired
private LDAPActions ldapActions; private LDAPActions ldapActions;
private EmailActions emailActions; //private EmailActions emailActions;
private Logger logger = Logger.getLogger(RemindUsernameServlet.class); private Logger logger = Logger.getLogger(RemindUsernameServlet.class);

View File

@ -35,13 +35,14 @@ public class VerificationCodeServlet extends HttpServlet {
String formVerificationCode = request.getParameter("verification_code"); String formVerificationCode = request.getParameter("verification_code");
if (verificationActions.verificationEntryExists(formUsername, formVerificationCode)) { if (verificationActions.verificationEntryExists(formUsername, formVerificationCode)) {
//TODO check expiration date if "now" is more than 24h from the date in DB return error message
//else go to next step resetPassword.jsp
response.sendRedirect("./resetPassword.jsp"); response.sendRedirect("./resetPassword.jsp");
printWriter.close();
} else { } else {
response.sendRedirect("./error.jsp"); // response.sendRedirect("./error.jsp"); or write a message in the session
} }
response.sendRedirect("./resetPassword.jsp");
printWriter.close();
} }
} }

View File

@ -53,7 +53,7 @@
<div class="alert alert-success" aria-hidden="true" style="display: none;"></div> <div class="alert alert-success" aria-hidden="true" style="display: none;"></div>
<div class="alert alert-danger" aria-hidden="true" style="display: none;"></div> <div class="alert alert-danger" aria-hidden="true" style="display: none;"></div>
<div class="form-group"> <div class="form-group">
<span id="server_error" class="uk-text-danger uk-text-small uk-float-left">${message}</span> <span id="server_error" class="uk-text-danger uk-text-small uk-float-left">${message}</span>
<c:remove var="message" scope="session" /> <c:remove var="message" scope="session" />
<span class="msg_email_error uk-text-danger uk-text-small uk-float-left" style="display:none">Please enter your email.</span> <span class="msg_email_error uk-text-danger uk-text-small uk-float-left" style="display:none">Please enter your email.</span>
<span class="msg_email_validation_error uk-text-danger uk-text-small uk-float-left" style="display:none">Please enter a valid email.</span> <span class="msg_email_validation_error uk-text-danger uk-text-small uk-float-left" style="display:none">Please enter a valid email.</span>