resetpassword.jsp
来自「Jive是基于JSP/JAVA技术构架的一个大型BBS论坛系统,这是Jive论坛」· JSP 代码 · 共 303 行
JSP
303 行
<%/** * $RCSfile: resetpassword.jsp,v $ * $Revision: 1.8 $ * $Date: 2002/07/01 21:05:34 $ */%><%@ page import="java.net.*, java.util.*, com.jivesoftware.forum.*, com.jivesoftware.forum.util.*" errorPage="error.jsp"%><%@ include file="global.jsp" %><% // Get parameters String username = ParamUtils.getParameter(request, "username"); long userid = ParamUtils.getLongParameter(request, "userid", -1); String token = ParamUtils.getParameter(request, "token"); String password = ParamUtils.getParameter(request, "password"); String confirmPassword = ParamUtils.getParameter(request, "confirmPassword"); String resetButton = ParamUtils.getParameter(request, "resetButton"); boolean firstTime = ParamUtils.getBooleanParameter(request, "firstTime"); boolean sendEmail = ParamUtils.getBooleanParameter(request, "sendEmail"); boolean emailSent = ParamUtils.getBooleanParameter(request, "emailSent"); boolean reset = ParamUtils.getBooleanParameter(request, "reset"); String skinCancel = SkinUtils.getLocalizedString("skin.default.global.cancel",locale); String usernameError = SkinUtils.getLocalizedString("skin.default.resetpassword.error_username",locale); String useridError = SkinUtils.getLocalizedString("skin.default.resetpassword.error_userid",locale); String emailError = SkinUtils.getLocalizedString("skin.default.resetpassword.error_email",locale); String unknownError = SkinUtils.getLocalizedString("skin.default.resetpassword.error_unknown",locale); String invalidUserOrTokenError = SkinUtils.getLocalizedString("skin.default.resetpassword.error_token",locale); String passwordError = SkinUtils.getLocalizedString("skin.default.resetpassword.error_passwords",locale); boolean resetEnabled = Boolean.valueOf(JiveGlobals.getJiveProperty("passwordReset.enabled")).booleanValue(); if (skinCancel.equals(resetButton)) { response.sendRedirect("auth.jsp?referrer=index.jsp"); return; } if (!isGuest && username == null) { username = pageUser.getUsername(); } // Error variables boolean errors = false; String errorMessage = ""; // send reset password email if requested if (sendEmail && resetEnabled) { if (username == null) { errors = true; errorMessage = usernameError; } if (!errors) { try { boolean result = SkinUtils.emailResetPasswordInstructions(username, request); if (!result) { errors = true; errorMessage = emailError; } else { // at this point if no exceptions were thrown, the email was // sent, so redirect to this page with instructional copy: response.sendRedirect("resetpassword.jsp?emailSent=true"); return; } } catch (IllegalArgumentException ue) { errors = true; errorMessage = unknownError; } } } else if (reset) { if (userid < 2 || token == null || password == null) { errors = true; errorMessage = useridError; } else if (!password.equals(confirmPassword)) { errors = true; errorMessage = passwordError; } else if (!SkinUtils.isValidPasswordToken(userid, token)) { errors = true; errorMessage = invalidUserOrTokenError; } if (!errors) { boolean result = SkinUtils.resetUserPassword(userid, token, password); if (result != true) { errors = true; errorMessage = unknownError; } else { try { User user = forumFactory.getUserManager().getUser(userid); username = user.getUsername(); } catch (UserNotFoundException e) { } } } }%><% String title = SkinUtils.getLocalizedString("skin.default.resetpassword.title",locale); %><%@ include file="header.jsp" %><table cellpadding="0" cellspacing="0" border="0" width="100%"><tr> <td> <%-- breadcrumbs --%> <font face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.linkColor") %>"> <b> <a href="<%= JiveGlobals.getJiveProperty("skin.default.homeURL") %>" ><%= SkinUtils.getLocalizedString("skin.default.global.home",locale) %></a> » <a href="index.jsp" title="<%= SkinUtils.getLocalizedString("skin.default.global.go_back_to_forum_list",locale) %>" ><%= SkinUtils.getLocalizedString("skin.default.global.forums",locale) %></a> » <a href="resetpassword.jsp?firstTime=true" class="header" title="<%= SkinUtils.getLocalizedString("skin.default.resetpassword.reset_password",locale) %>" ><%= SkinUtils.getLocalizedString("skin.default.resetpassword.reset_password",locale) %></a> </b> </font> </td></tr></table><p><% // If password reset functionality is disabled, inform the user if (!resetEnabled) {%> <font size="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.textColor") %>"> <%= SkinUtils.getLocalizedString("skin.default.resetpassword.error_disabled",locale) %> </font><% } else if (emailSent) {%> <font size="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.textColor") %>"> <%= SkinUtils.getLocalizedString("skin.default.resetpassword.emailSent",locale) %> </font><% } else if (firstTime || (sendEmail && errors)) {%> <font size="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.textColor") %>"> <%= SkinUtils.getLocalizedString("skin.default.resetpassword.howto_description",locale) %> </font> <% if (errors) { %> <p> <font size="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>" color="#ff0000" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>"> <%= errorMessage %> </font> <% } %> <form action="resetpassword.jsp" method="post" name="resetForm"> <input type="hidden" name="sendEmail" value="true"> <table cellpadding="2" cellspacing="0" border="0" align="center"> <tr><td> <font size="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.textColor") %>"> <%= SkinUtils.getLocalizedString("skin.default.global.username",locale) %> </font> </td> <td> </td> <td> <input type="text" name="username" size="30" maxlength="100" value="<%= (username!=null)?username:"" %>"> </td> </tr> <tr><td colspan="3" align="center"> <br> <input type="submit" name="resetButton" value="<%= SkinUtils.getLocalizedString("skin.default.global.continue",locale) %>"> <input type="submit" name="resetButton" value="<%= SkinUtils.getLocalizedString("skin.default.global.cancel",locale) %>"> </td> </tr> </table> </form> <script language="JavaScript" type="text/javascript"> <!-- document.resetForm.username.focus(); //--> </script><% } else if (reset && !errors) {%> <font size="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.textColor") %>"> <%= SkinUtils.getLocalizedString("skin.default.resetpassword.success",locale) %> </font> <p> <a href="auth.jsp?referrer=index.jsp&username=<%=username%>" title="<%= SkinUtils.getLocalizedString("skin.default.login.login_jive",locale) %>" ><%= SkinUtils.getLocalizedString("skin.default.global.login",locale) %></a><% } else {%> <font size="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.textColor") %>"> <%= SkinUtils.getLocalizedString("skin.default.resetpassword.reset_description",locale) %> </font> <% if (errors) { %> <p> <font size="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>" color="#ff0000" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>"> <%= errorMessage %> </font> <% } %> <form action="resetpassword.jsp" method="post" name="resetForm"> <input type="hidden" name="reset" value="true"> <center> <table cellpadding="2" cellspacing="0" border="0"> <tr> <td> <font size="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.textColor") %>"> <%= SkinUtils.getLocalizedString("skin.default.global.userid",locale) %><%= SkinUtils.getLocalizedString("skin.default.global.colon",locale) %> </font> </td> <td> <input type="text" name="userid" size="20" maxlength="20" value="<% if (userid > 1) { %><%= userid %><% } %>"> </td> </tr> <tr> <td> <font size="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.textColor") %>"> <%= SkinUtils.getLocalizedString("skin.default.global.token",locale) %><%= SkinUtils.getLocalizedString("skin.default.global.colon",locale) %> </font> </td> <td> <input type="text" name="token" size="20" maxlength="8" value="<% if (token != null) { %><%= token %><% } %>"> </td> </tr> <tr> <td> <font size="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.textColor") %>"> <%= SkinUtils.getLocalizedString("skin.default.global.password",locale) %><%= SkinUtils.getLocalizedString("skin.default.global.colon",locale) %> </font> </td> <td> <input type="password" name="password" size="15" maxlength="50"> </td> </tr> <tr> <td> <font size="<%= JiveGlobals.getJiveProperty("skin.default.fontSize") %>" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.textColor") %>"> <%= SkinUtils.getLocalizedString("skin.default.global.confirm_password",locale) %><%= SkinUtils.getLocalizedString("skin.default.global.colon",locale) %> </font> </td> <td> <input type="password" name="confirmPassword" size="15" maxlength="50"> </td> </tr> <tr><td colspan="2"> </td></tr> <tr> <td colspan="2" align="center"> <input type="submit" name="resetButton" value="<%= SkinUtils.getLocalizedString("skin.default.resetpassword.reset_password",locale) %>"> <input type="submit" name="resetButton" value="<%= SkinUtils.getLocalizedString("skin.default.global.cancel",locale) %>"> </td> </tr> </table> </form> <p> </center> <script language="JavaScript" type="text/javascript"> <!-- document.resetForm.userid.focus(); //--> </script><% } %><p><%@ include file="footer.jsp" %>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?