⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 auth.jsp

📁 jive3论坛开源 最新 有版主功能 jive3论坛开源 最新 有版主功能 jive3论坛开源 最新 有版主功能
💻 JSP
字号:
<%/** *	$RCSfile: auth.jsp,v $ *	$Revision: 1.2 $ *	$Date: 2002/10/28 02:35:23 $ */%><%@ page import="java.util.*,                 com.jivesoftware.util.*,                 com.jivesoftware.forum.*,                 com.jivesoftware.forum.util.*,                 com.jivesoftware.base.*"    errorPage="error.jsp"%><%  // Page Description:    //    // This page handles logging into the system as well as logouts.%><%  // global.jsp - see description on index.jsp %><%@ include file="global.jsp" %><%  // Get parameters:    // The username    String username = ParamUtils.getParameter(request,"username");    // The password    String password = ParamUtils.getParameter(request,"password");    // Indicates if the user wants to do an autologin:    boolean autoLogin = ParamUtils.getBooleanParameter(request,"autoLogin");    // Indicates if we should try to login:    boolean login = ParamUtils.getBooleanParameter(request,"login");    // Indicates if we should try to logout:    boolean logout = ParamUtils.getBooleanParameter(request,"logout");    // Indicates we should cancel the process of logging in.    boolean cancel = request.getParameter("cancel") != null;    // Indicates we should redirect to creating a new account    boolean newAccount = request.getParameter("newAccount") != null;    // Handle a cancel case:    if (cancel) {        // Redirect to the front page:        response.sendRedirect("index.jsp");        return;    }    // Handle a new account case:    if (newAccount) {        // Redirect to the account page:        response.sendRedirect("account.jsp");        return;    }    // Handle a logout case:    if (logout) {        // The following methds might        try {            // First, remove the user's authorization token from the session.            // More about the auth token can be found in global.jsp            session.removeAttribute(AuthFactory.SESSION_AUTHORIZATION);            // Next, delete the login cookie (for auto-logins). This may or            // may not be set. Regardless, try to delete it anyway.            CookieUtils.deleteCookie(response,                CookieUtils.getCookie(request,AuthFactory.COOKIE_AUTOLOGIN));            // We successfully logged out so redirect to the front page.            // Another idea might be to redirect to a 'logout success' page,            // but for simplicity's sake we'll just redirect to the front page.            response.sendRedirect("index.jsp");            return;        }        catch (Exception e) {}    }    // Handle the login case:    boolean errors = false;    if (login) {		if (username == null || password == null) {            errors = true;        } else {			try {                // Try to create an auth token based on the username and                // password. If this fails, an exception is thrown, otherwise                // a valid authorization token will be returned. Here 'authToken'                // is a local variable because global.jsp is included so we                // just need to re-initialize it.                authToken = AuthFactory.getAuthToken(username,password);                // At this point, login would have been successful so put the                // valid token in the session.                session.setAttribute(AuthFactory.SESSION_AUTHORIZATION, authToken);                // Optionally set a cookie with the user's username and password                if (autoLogin) {                    CookieUtils.setCookie(response,AuthFactory.COOKIE_AUTOLOGIN,                        AuthFactory.encryptAuthInfo(username, password));                }                // At this point, login was successful so redirect:                response.sendRedirect("index.jsp");                return;			}			catch (UnauthorizedException ue) {				errors = true;			}		}    }%><%@ include file="header.html" %><jsp:include page="breadcrumbs.jsp" flush="true" /><p>Use the form below to login or click "Create New Account" to create a newuser account.</p><%  // Display an error message if there was a login error:    if (errors) {%>    <p class="error-text">    There was an error logging in - make sure your username and password    are correct. If you do not have an account, click "Create New Account"    below.    </p><%    }%><form action="auth.jsp" method="post" name="loginform"><input type="hidden" name="login" value="true"><table id="login-form" cellpadding="2" cellspacing="2" border="0" align="center"><tr>    <td width="50%" class="label">        Username:    </td>    <td width="50%">        <input type="text" name="username" size="20" maxlength="100">    </td></tr><tr>    <td width="50%" class="label">        Password:    </td>    <td width="50%">        <input type="password" name="password" size="20" maxlength="100">    </td></tr><tr>    <td width="50%" class="label">        Remember Me:    </td>    <td width="50%">        <input type="checkbox" name="autoLogin">    </td></tr><tr>    <td colspan="2" align="center" nowrap>        <br>        <input type="submit" value="Login" class="main-button">        <input type="submit" value="Create New Account" name="newAccount">        <input type="submit" value="Cancel" name="cancel" class="cancel-button">    </td></tr></table></form><script language="JavaScript" type="text/javascript"><!--document.loginform.username.focus();//--></script><%@ include file="footer.html" %>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -