%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"
import="java.util.*"
import="javax.servlet.http.HttpServletRequest"
import="org.starhope.appius.user.*"
import="org.starhope.appius.mb.Messages"
import="org.starhope.appius.except.*"
import="org.starhope.appius.messaging.*"
import="org.starhope.appius.types.AgeBracket"
import="com.tootsville.WebUtil"
%><%
User lifeguard = null;
/** Ensure that the user is logged in and has staff priveledges. */
if (null!=session.getAttribute("lifeguard") && null!=session.getAttribute("password")) {
lifeguard = User.getByLogin((String) session.getAttribute("lifeguard"));
if (null!=lifeguard && lifeguard.checkPassword(session.getAttribute("password").toString())) {
if (lifeguard.hasStaffLevel(User.STAFF_LEVEL_MODERATOR)) {
if (null!=request.getParameter("user") && null!=request.getParameter("action")) {
User user = User.getByID(Integer.parseInt((String) request.getParameter("user")));
String action = request.getParameter("action");
if (action.equals("approve")) {
user.approveName(lifeguard);
System.err.println("Approving the name: " + user.getUserName());
} else {
System.err.println("Denying the name: " + user.getRequestedName() );
user.setNeedsNaming(true);
}
response.sendRedirect("/Joshua/name-approve/");
} else {
System.err.println("Action is null");
}
} else {
System.err.println("Staff level invalid");
}
} else {
if (null!=lifeguard) {
System.err.println("user object invalid");
response.sendRedirect("/Joshua/name-approve/");
}
if (lifeguard.checkPassword((String) session.getAttribute("password"))) {
System.err.println("password invalid");
response.sendRedirect("/Joshua/name-approve/");
}
}
} else {
System.err.println("Session invalid");
response.sendRedirect("/Joshua/name-approve/");
}
%>