<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="org.unicode.cldr.web.*"%> <% String email = request.getParameter("email"); if(email==null&&email.isEmpty()) { response.sendRedirect(request.getContextPath()+"/survey#err_noemail"); } email = email.trim().toLowerCase(); String s = request.getParameter("s"); if(s==null&&s.isEmpty()) { response.sendRedirect(request.getContextPath()+"/survey#err_nosession"); } CookieSession cs = CookieSession.retrieve(s); if(cs==null) { response.sendRedirect(request.getContextPath()+"/survey#err_badsession"); return; } if(cs.user!=null) { response.sendRedirect(request.getContextPath()+"/survey#err_alreadyloggedin"); return; } if(email.contains("admin@") || !email.contains("@") || !email.contains(".") || email.length()<5) { response.sendRedirect(request.getContextPath()+"/survey#err_badreq"); return; } Integer sumAnswer = (Integer)cs.stuff.get("sumAnswer"); String userAnswer = request.getParameter("sumAnswer"); int hashA = (int)(Math.random()*11.0); int hashB = (int)(Math.random()*11.0); int hashC = hashA+hashB; %> SurveyTool | Password Reset | <%= email %>

SurveyTool | Password Reset | <%= email %>

<% // did they get it right? Integer userAnswerInt = null; if(userAnswer!=null) { try { userAnswerInt = Integer.parseInt(userAnswer); } catch(Throwable t) { // } } if( (userAnswer!=null) && (userAnswerInt!=null) && (sumAnswer.intValue()==userAnswerInt.intValue())) { %> Attempting to reset password: <%= cs.sm.reg.resetPassword(email, WebContext.userIP(request)) %>
If the email address on file is correct, your new password should be on its way. Check your inbox. If you have difficulty still, contact the person who set up your account.

As a reminder, please do not re-use the new randomly-generated password on other web sites. <% } else { // put it in the hash cs.stuff.put("sumAnswer", hashC); if(userAnswer!=null) { if(userAnswerInt==null) { %> Please enter your answer.
<% } else { %> Sorry, that answer was wrong.
<% } }%>

To reset your password, please solve this simple math problem: What is the sum of <%= hashA %> + <%= hashB %> ? <% if(SurveyMain.isUnofficial() ) { %>Hint: <%= hashC %> <% } %>
<% } %>
Return to the Survey Tool