
<%
/**
 *	$RCSfile: login.jsp,v $
 *	$Revision: 1.1.1.1 $
 *	$Date: 2002/09/09 13:50:23 $
 */
%>

<%@ page import="java.util.*,
                 com.jivesoftware.forum.*,
                 com.jivesoftware.forum.util.*"
    errorPage="error.jsp"
%>

<%@ include file="include/branding/style.jsp" %>

<%@ include file="include/forumSetup.jsp" %>

<%  // Get parameters
    String username = ParamUtils.getParameter(request,"username");
    String password = ParamUtils.getParameter(request,"password");
    String referrer = ParamUtils.getParameter(request,"referrer");
    boolean login = ParamUtils.getBooleanParameter(request,"login");
    boolean logout = ParamUtils.getBooleanParameter(request,"logout");
    boolean autoLogin = ParamUtils.getBooleanParameter(request,"autoLogin");
    
    if (referrer == null) {
        referrer = request.getHeader("REFERER");
    }
    
    // Error variables
    boolean errors = false;
    String errorMessage = "";
    
    // logout if requested
    if (logout) {
        SkinUtils.logout(request,response);
        if (referrer == null) {
            referrer = request.getHeader("REFERER");
            if (referrer == null) {
                referrer = "index.jsp";
            }
        }
        response.sendRedirect(referrer);
        return;
    }
    
    // login if requested
    if (login) {
		if (username == null || password == null) {
			errors = true;
			errorMessage = "Please enter a username and password.";
		}
		if (!errors) {
			try {
				SkinUtils.login(
					request,response,username,password,autoLogin
				);
				// at this point if no exceptions were thrown, the user is
				// logged in, so redirect to the page that sent us here:
				response.sendRedirect(referrer);
				return;
			}
			catch (UnauthorizedException ue) {
				errors = true;
				errorMessage = "Invalid username or password.";
			}
		}
    }
%>

<%  String title = "Jive Software: Communities: Login"; %>
<%@ include file="include/header.jsp" %>

<%@ include file="include/branding/header.jsp" %>

<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
    <td>
    
    <span class="header">
    <%  if (rootBreadcrumbText != null && rootBreadcrumbLink != null) { %>
    <a href="<%= rootBreadcrumbLink %>" class="header"
    ><%= rootBreadcrumbText %></a>
    &raquo;
    <%  } %>
    <a href="index.jsp" class="header" title="Go back to the forum listing"
    >Forums</a>
    &raquo;
    <a href="login.jsp" class="header" title="Login into Jive"
    >Login</a>
    </span>

    </td>
</tr>
</table>

<p><br>

<font size="-1">

<%  if (errors) { %>
    <%= errorMessage %>
    <p>
<%  } %>

<form action="login.jsp" method="post" name="loginForm">
<input type="hidden" name="login" value="true">
<input type="hidden" name="referrer" value="<%= referrer %>">

<center>

<table cellpadding="2" cellspacing="0" border="0">
<tr>
    <td>
        <font size="-1">
        username
        </font>
    </td>
    <td>
    <input type="text" name="username" size="12" maxlength="20">
    </td>
</tr>
<tr>
    <td>
        <font size="-1">
        password
        </font>
    </td>
    <td>
    <input type="password" name="password" size="12" maxlength="20">
    </td>
</tr>
<tr>
    <td align="right">
    <input type="checkbox" name="autoLogin" id="cb01">
    </td>
    <td>
        <font size="-1">
        <label for="cb01">auto login</label>
        </font>
    </td>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr>
    <td colspan="2" align="center">
    <input type="submit" value="Login">
    </td>
</tr>
</table>

<p>

No account? <a href="account.jsp">Create one here.</a>
<p>

</form>

</center>

</font>

<script language="JavaScript" type="text/javascript">
<!--
document.loginForm.username.focus();
//-->
</script>

<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
    <td align="right">
    <a href="http://www.jivesoftware.com/poweredby/" target="_blank"
    ><img src="images/powered_by_jive.gif" width="100" height="30" alt="Powered by Jive" border="0"></a>
    </td>
</tr>
</table>

<%@ include file="include/branding/footer.jsp" %>

<%@ include file="include/footer.jsp" %>