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

📄 setup5.jsp

📁 java开发的一套非常好用的oa系统
💻 JSP
字号:
<%
/**
 * $RCSfile: setup5.jsp,v $
 * $Revision: 1.1.1.1 $
 * $Date: 2002/09/09 13:50:32 $
 *
 * Copyright (C) 1999-2001 CoolServlets, Inc. All rights reserved.
 *
 * This software is the proprietary information of CoolServlets, Inc.
 * Use is subject to license terms.
 */
%>

<%@ page import="java.io.*,
                 java.util.*,
                 java.lang.reflect.*,
                 com.jivesoftware.forum.*,
				 com.jivesoftware.forum.util.*,
				 com.jivesoftware.util.*"
%>

<% 
	Locale locale = JiveGlobals.getLocale();
	// Set the JSP page to use the Jive locale
	response.setLocale(locale);
	// Load the appropriate resource bundle to display the page.
	ResourceBundle bundle = SkinUtils.getResourceBundle("skin_admin_setup", locale);
%>

<%	// get parameters
    boolean setupCompleted = false;
    Object completed = session.getAttribute("setupCompleted");
    if (completed != null) {
        setupCompleted = ((Boolean)completed).booleanValue();
    }
	boolean updateAdmin = ParamUtils.getBooleanParameter(request,"updateAdmin");
	String currentPassword = ParamUtils.getParameter(request, "currentPassword");
	String password = ParamUtils.getParameter(request,"password");
	if (password == null) {
		password = "";
	}
	String confirmPassword = ParamUtils.getParameter(request,"confirmPassword");
	if (confirmPassword == null) {
		confirmPassword = "";
	}
	String email = ParamUtils.getParameter(request,"email");
	
	boolean errors = false;
	String errorMessage = "";
	if (!setupCompleted && updateAdmin) {
		if (!password.equals(confirmPassword)) {
			errors = true;
			errorMessage = "The passwords you supplied did not match. Please retype them carefully below.";
		}
		if (password.equals("")) {
			errors = true;
			errorMessage = "You can not specify a blank password.";
		}
		else {
			Authorization auth = null;
			try {
				auth = AuthorizationFactory.getAuthorization("admin", currentPassword);
			}
			catch (UnauthorizedException ue) {
				errors = true;
				errorMessage = "The value you supplied for the current password field does not " +
					"appear to be the valid password for the admin account. Try again with the " +
					"correct password.";
			}
			if (!errors) {
				try {
					ForumFactory forumFactory = ForumFactory.getInstance(auth);
					UserManager userManager = forumFactory.getUserManager();
					User admin = userManager.getUser("admin");
					admin.setPassword(password);
					if (email != null) {
						admin.setEmail(email);
					}
					Date now = new Date();
					admin.setCreationDate(now);
					admin.setModifiedDate(now);
                    
					// Everything seems to have worked!
                    session.setAttribute("setupCompleted",new Boolean(true));
                    session.setAttribute("sidebar.3.light", GREEN);
					response.sendRedirect("setup5.jsp");
					return;
				}
				catch (Exception e) {
					e.printStackTrace();
					errors = true;
					errorMessage = "There was an unexpected error encountered when setting the new " +
						"admin information. Please check your error logs and attempt to remedy the problem.";
				}
			}
		}
	}
%>

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

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

<table cellpadding="6" cellspacing="0" border="0" width="100%">
<tr>
<td width="1%" valign="top">
<%  // set sidebar properties
    if (!GREEN.equals(getSessionString(session,"sidebar.3.light"))) {
        session.setAttribute("sidebar.3.light", YELLOW);
    }
%>
<%@ include file="include/sidebar.jsp" %>
</td>
<td width="99%" valign="top">

    <b>Administrator Account Setup</b>
    <hr size="0">

<%  if (!setupCompleted) { %>
    
	<font size="-1">
	The Jive Forums database schemas include a default admin account password of "admin" which must be changed
	for security reasons. You should also provide a valid email address so that you can be alerted of system
	errors.
    <p>

    <%  if (errors) { %>
        <font color="#cc3300">
        <i><%= errorMessage %></i>
        <p>
        </font>
    <%  } %>
    
	<ul>
	<form action="setup5.jsp" mode="post">
	<input type="hidden" name="updateAdmin" value="true">
	
	<table cellpadding="3" cellspacing="0" border="0">
	<tr>
		<td><font size="-1">current password</font></td>
		<td><input type="text" size="30" name="currentPassword" value="admin"></td>
	</tr>
	<tr>
		<td><font size="-1">email address</font></td>
		<td><input type="text" size="30" name="email" value=""></td>
	</tr>
	<tr>
		<td><font size="-1">new password</font></td>
		<td><input type="password" size="30" name="password" value=""></td>
	</tr>
	<tr>
		<td><font size="-1">confirm password</font></td>
		<td><input type="password" size="30" name="confirmPassword" value=""></td>
	</tr>
	</table>

</ul>

<p>
<hr size="0">
<center>
<input type="submit" value="Update Admin Account">
</center>
</form>

<%  } %>

<%  if (setupCompleted) {
        // set "setup" property equal to true
        JiveGlobals.setJiveProperty("setup","true");
%>

    <font size="-1">
    Jive Forums setup is now complete! To continue, click the button below
    to login to the Jive admin tool.
    <p>
    </font>
    
    <form action="../index.jsp">
    <hr size="0">
    <center>
    <input type="submit" value="Login to Jive">
    </center>
    </form>

<%  } %>

<jsp:include page="include/footer.jsp" flush="true"/>

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



⌨️ 快捷键说明

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