minor cahnges
This commit is contained in:
parent
6aa55c08c7
commit
2272f14978
|
@ -50,14 +50,13 @@ public class ForgotPasswordServlet extends HttpServlet {
|
|||
}
|
||||
|
||||
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.");
|
||||
response.sendRedirect("./forgotPassword.jsp");
|
||||
|
||||
} else {
|
||||
String username = ldapActions.getUsername(userEmail);
|
||||
UUID verificationCode = UUID.randomUUID();
|
||||
Date creationDate = new Date();
|
||||
|
||||
|
@ -68,7 +67,7 @@ public class ForgotPasswordServlet extends HttpServlet {
|
|||
verificationActions.updateVerificationEntry(username, verificationCode.toString(), creationDate);
|
||||
}
|
||||
|
||||
emailActions.sendVerificationCode(userEmail);
|
||||
emailActions.sendVerificationCode(formEmail);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package eu.dnetlib.openaire.usermanagement;
|
||||
|
||||
import com.unboundid.ldap.sdk.LDAPException;
|
||||
import eu.dnetlib.openaire.user.utils.EmailActions;
|
||||
import eu.dnetlib.openaire.user.utils.LDAPActions;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -30,7 +29,7 @@ public class RemindUsernameServlet extends HttpServlet {
|
|||
@Autowired
|
||||
private LDAPActions ldapActions;
|
||||
|
||||
private EmailActions emailActions;
|
||||
//private EmailActions emailActions;
|
||||
|
||||
private Logger logger = Logger.getLogger(RemindUsernameServlet.class);
|
||||
|
||||
|
|
|
@ -35,13 +35,14 @@ public class VerificationCodeServlet extends HttpServlet {
|
|||
String formVerificationCode = request.getParameter("verification_code");
|
||||
|
||||
if (verificationActions.verificationEntryExists(formUsername, formVerificationCode)) {
|
||||
response.sendRedirect("./resetPassword.jsp");
|
||||
|
||||
} else {
|
||||
response.sendRedirect("./error.jsp");
|
||||
}
|
||||
|
||||
//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");
|
||||
printWriter.close();
|
||||
|
||||
} else {
|
||||
// response.sendRedirect("./error.jsp"); or write a message in the session
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue