Revision 49552
Added by Sofia Baltzi over 6 years ago
modules/dnet-openaire-users/trunk/src/main/java/eu/dnetlib/openaire/usermanagement/ResetPasswordServlet.java | ||
---|---|---|
45 | 45 |
String password = request.getParameter("password"); |
46 | 46 |
String confirmPassword = request.getParameter("password_conf"); |
47 | 47 |
|
48 |
// if (username != null) { |
|
48 |
if (password.equals(confirmPassword) && username != null) { |
|
49 |
try { |
|
50 |
ldapActions.resetPassword(username, password); |
|
51 |
logger.info("password resetted"); |
|
49 | 52 |
|
50 |
if (password.equals(confirmPassword) && username != null) { |
|
51 |
try { |
|
52 |
ldapActions.resetPassword(username, password); |
|
53 |
logger.info("password resetted"); |
|
54 |
|
|
55 |
} catch (Exception e) { |
|
56 |
logger.error("LDAP error in resetting password", e); |
|
57 |
response.sendRedirect("./error.jsp"); |
|
58 |
} |
|
53 |
} catch (Exception e) { |
|
54 |
logger.error("LDAP error in resetting password", e); |
|
55 |
response.sendRedirect("./error.jsp"); |
|
59 | 56 |
} |
57 |
} |
|
60 | 58 |
|
61 |
session.removeAttribute("username");
|
|
62 |
response.sendRedirect("./success.jsp");
|
|
63 |
printWriter.close();
|
|
59 |
session.removeAttribute("username"); |
|
60 |
response.sendRedirect("./success.jsp"); |
|
61 |
printWriter.close(); |
|
64 | 62 |
|
65 |
// } else { |
|
66 |
// response.sendRedirect("./forgotPassword.jsp"); |
|
67 |
// printWriter.close(); |
|
68 |
// } |
|
69 | 63 |
} |
70 | 64 |
} |
modules/dnet-openaire-users/trunk/src/main/webapp/resetPassword.jsp | ||
---|---|---|
1 | 1 |
<!DOCTYPE html> |
2 | 2 |
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> |
3 |
<%--<% if (session.getAttribute("username") == null) {--%>
|
|
4 |
<%--String redirectURL = "/dnet-openaire-users-1.0.0-SNAPSHOT/forgotPassword.jsp";--%>
|
|
5 |
<%--response.sendRedirect(redirectURL);--%>
|
|
6 |
<%--}--%>
|
|
7 |
<%--%>--%>
|
|
3 |
<% if (session.getAttribute("username") == null) {
|
|
4 |
String redirectURL = "/dnet-openaire-users-1.0.0-SNAPSHOT/forgotPassword.jsp";
|
|
5 |
response.sendRedirect(redirectURL);
|
|
6 |
}
|
|
7 |
%> |
|
8 | 8 |
<%--<%String name=(String)request.getAttribute("name");--%> |
9 | 9 |
<%--out.print("your name"+name);%>--%> |
10 | 10 |
<html lang="en-gb" dir="ltr" vocab="http://schema.org/"> |
... | ... | |
85 | 85 |
|
86 | 86 |
// When the user starts to type something inside the password field |
87 | 87 |
myInput.onkeyup = function() { |
88 |
|
|
88 |
|
|
89 | 89 |
// Validate lowercase letters |
90 | 90 |
var lowerCaseLetters = /[a-z]/g; |
91 | 91 |
if (myInput.value.match(lowerCaseLetters)) { |
Also available in: Unified diff
Redirect to forgotPassword if the username in the session is null