%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%-- Included in siteAdmin/main.jsp to handle login/logout form and processing --%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Portal" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
<%
int securityLevel = loginHandler.ANYBODY;
String loginStatus = loginHandler.getLoginStatus();
if ( loginStatus.equals("authenticated")) {
%>
<%
} else {
%>
<%
}
if ( loginStatus.equals("authenticated")) {
// test whether session is still valid
String currentSessionId = session.getId();
String storedSessionId = loginHandler.getSessionId();
if ( currentSessionId.equals( storedSessionId ) ) {
String currentRemoteAddrStr = request.getRemoteAddr();
String storedRemoteAddr = loginHandler.getLoginRemoteAddr();
securityLevel = Integer.parseInt( loginHandler.getLoginRole() );
if ( currentRemoteAddrStr.equals( storedRemoteAddr ) ) {
%>
<%
} else {
%>
${loginFormTitle}
(IP address has changed)
<%
loginHandler.setLoginStatus("logged out");
}
} else {
loginHandler.setLoginStatus("logged out");
%>
${loginFormTitle}
(session has expired)
<%
}
} else { /* not thrown out by coming from different IP address or expired session; check login status returned by authenticate.java */
%>
Please log in
<%
if ( loginStatus.equals("logged out")) { %>
(currently logged out)
<% } else if ( loginStatus.equals("bad_password")) { %>
(password incorrect)
<% } else if ( loginStatus.equals("unknown_username")) { %>
(unknown username)
<% } else if ( loginStatus.equals("first_login_no_password")) { %>
(1st login; need to request initial password below)
<% } else if ( loginStatus.equals("first_login_mistyped")) { %>
(1st login; initial password entered incorrectly)
<% } else if ( loginStatus.equals("first_login_changing_password")) { %>
(1st login; changing to new private password)
<% } else if ( loginStatus.equals("changing_password_repeated_old")) { %>
(changing to a different password)
<% } else if ( loginStatus.equals("changing_password")) { %>
(changing to new password)
<% } else if ( loginStatus.equals("none")) { %>
(new session)
<% } else { %>
Status unrecognized: <%=loginStatus.replace("_", " ")%>
<% } %>
<% } %>