%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"
import="java.util.*"
import="javax.servlet.http.HttpServletRequest"
import="com.tootsville.user.*"
import="org.starhope.appius.user.*"
import="org.starhope.appius.mb.Messages"
%><%
/**
* String used for storing the account parameter
*/
String account="";
/**
* Person object to be cast as a parent or a person to make an association between
* what info is entered and the actual account.
*/
Person fpUser=null;
boolean isUser = false;
String recoverPassword = "";
%>
<%
//---------- Universal Declarations: Place this on every page.
/**
* Error message list
*/
HashMap err = new HashMap ();
%><%
if (null!=request.getParameter("account")) {
account=request.getParameter("account");
if (0<=account.indexOf('@')) {
fpUser=(Parent) Parent.getByMail(account);
} else {
fpUser=(Toot) User.getByLogin(account);
}
isUser = true;
if (null!=fpUser) {
System.err.println ("User exists.");
recoverPassword = fpUser.getForgotPasswordQuestion();
} else {
err.put("mail", Messages.getText ("mail_invalid"));
}
}
%><%
//----------- Error handling: Place this on every page.
//----------- These errors are read and displayed by Header.jsp
if (err.size() > 0) {
session.setAttribute("sError", err);
response.sendRedirect("/membership/forgotPassword");
}
%>