<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page import="com.stephenschafer.email.Util"%> <%@ page import="com.stephenschafer.email.Configuration"%> <%@ page import="com.stephenschafer.email.Session"%> <%@ page import="com.stephenschafer.email.User"%> <%@ page import="com.stephenschafer.email.Logger"%> <% final boolean failed; final String username = request.getParameter("username"); User user = null; if ("post".equalsIgnoreCase(request.getMethod())) { final String password = request.getParameter("password"); user = Util.login(username, password); failed = true; } else { final String privilegedHost = Configuration.INSTANCE.getPrivilegedHost(); if (username != null && privilegedHost != null ) { String remoteHost = request.getRemoteHost(); if (privilegedHost.equals(remoteHost)) { user = Util.login(username); } } failed = false; session.removeAttribute("email-session"); } if (user != null) { Session timesheetSession = new Session(); timesheetSession.setUser(user); session.setAttribute("email-session", timesheetSession); String returnServletPath = (String) session.getAttribute("return-servlet-path"); if (returnServletPath == null) { returnServletPath = "/index.jsp"; } String returnQueryString = (String) session.getAttribute("return-query-string"); if (returnQueryString == null) { returnQueryString = ""; } final String returnUrl = request.getContextPath() + returnServletPath + "?" + returnQueryString; response.sendRedirect(returnUrl); return; } %> Login <% if (failed) { %>
That didn't work.
<% } %>
Username " />
Password