|
|
|
@ -372,14 +372,17 @@ public class Web extends TemplateServlet {
@@ -372,14 +372,17 @@ public class Web extends TemplateServlet {
|
|
|
|
|
case RESET_PASSWORD: |
|
|
|
|
if (!isGet) return resetPassword(req,resp); |
|
|
|
|
// TODO: move following code into resetPassword method
|
|
|
|
|
try { |
|
|
|
|
user = User.byToken(req.getParameter(TOKEN)); |
|
|
|
|
if (user != null) { |
|
|
|
|
var token = req.getParameter(TOKEN); |
|
|
|
|
if (token != null){ |
|
|
|
|
try { |
|
|
|
|
user = User.byToken(req.getParameter(TOKEN)); |
|
|
|
|
if (user == null) return loadTemplate(path,Map.of(ERROR,"Failed to find user for token!"),resp); |
|
|
|
|
user.dropPasswordToken(); |
|
|
|
|
req.getSession().setAttribute("user",user); |
|
|
|
|
return redirectTo(NEW_PASSWORD_FORM,resp); |
|
|
|
|
} catch (SQLException sqle){ |
|
|
|
|
return loadTemplate(path,Map.of(ERROR,"Failed to add user for token!"),resp); |
|
|
|
|
} |
|
|
|
|
} catch (SQLException sqle){ |
|
|
|
|
return loadTemplate(path,Map.of(ERROR,"Failed to add user for token!"),resp); |
|
|
|
|
} |
|
|
|
|
var email = req.getParameter(EMAIL); |
|
|
|
|
return loadTemplate(path,email == null ? null : Map.of(EMAIL,email),resp); |
|
|
|
|