📄 setup5.jsp
字号:
<%@ page contentType="text/html;charset=GB2312" %>
<%
/**
* $RCSfile: setup5.jsp,v $
* $Revision: 1.1.1.1 $
* $Date: 2002/09/09 13:50:22 $
*
* 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 = "输入的两次口令不匹配。请重新输入。";
}
if (password.equals("")) {
errors = true;
errorMessage = "口令不能为空";
}
else {
Authorization auth = null;
try {
auth = AuthorizationFactory.getAuthorization("admin", currentPassword);
}
catch (UnauthorizedException ue) {
errors = true;
errorMessage = "你给出的管理员口令不正确。请使用正确口令重试。";
}
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 = "设置管理员信息时发生错误。请检查错误日志试着修正错误。";
}
}
}
}
%>
<%@ include file="global.jsp" %>
<%@ include file="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="sidebar.jsp" %>
</td>
<td width="99%" valign="top">
<b>管理员账号设置</b>
<hr size="0">
<% if (!setupCompleted) { %>
<font size="-1">
Jive论坛数据库脚本包括一个缺省的管理员账号,口令为"admin",基于安全的考虑,必须修改此口令。你也应该提供一个合法的邮件地址,在发生系统错误时能够被警告。
<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">当前口令</font></td>
<td><input type="text" size="30" name="currentPassword" value="admin"></td>
</tr>
<tr>
<td><font size="-1">email</font></td>
<td><input type="text" size="30" name="email" value=""></td>
</tr>
<tr>
<td><font size="-1">新口令</font></td>
<td><input type="password" size="30" name="password" value=""></td>
</tr>
<tr>
<td><font size="-1">口令确认</font></td>
<td><input type="password" size="30" name="confirmPassword" value=""></td>
</tr>
</table>
</ul>
<p>
<hr size="0">
<center>
<input type="submit" value="更新管理员账号">
</center>
</form>
<% } %>
<% if (setupCompleted) {
// set "setup" property equal to true
JiveGlobals.setJiveProperty("setup","true");
%>
<font size="-1">
Jive论坛安装完成!请点击下面的登录按钮登录到Jive管理工具。
<p>
</font>
<form action="../index.jsp">
<hr size="0">
<center>
<input type="submit" value="管理登录">
</center>
</form>
<% } %>
</td>
</tr>
</table>
<%@ include file="footer.jsp" %>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -