?? account.jsp
字號:
<%@ page contentType="text/html;charset=ISO8859_1" %>
<%
/**
* $RCSfile: account.jsp,v $
* $Revision: 1.3 $
* $Date: 2002/09/30 14:56:16 $
*/
%>
<%@ page import="com.jivesoftware.forum.*,
com.jivesoftware.forum.util.*"
errorPage="error.jsp"
%>
<%@ include file="global.jsp" %>
<% // Get parameters
boolean create = ParamUtils.getBooleanParameter(request,"create");
String username = ParamUtils.getParameter(request,"username");
String password = ParamUtils.getParameter(request,"password");
String confirmPassword = ParamUtils.getParameter(request,"confirmPassword");
String email = ParamUtils.getParameter(request,"email");
String name = ParamUtils.getParameter(request,"name");
String location = ParamUtils.getParameter(request,"location");
String occupation = ParamUtils.getParameter(request,"occupation");
String homepage = ParamUtils.getParameter(request,"homepage");
boolean autoLogin = ParamUtils.getBooleanParameter(request,"autoLogin");
String referrer = ParamUtils.getParameter(request,"referrer");
if ("null".equals(referrer)) {
referrer = null;
}
if (referrer == null) {
referrer = request.getHeader("REFERER");
}
String createButton = ParamUtils.getParameter(request,"createButton");
if ("取 消".equals(createButton)) {
if (referrer == null) {
referrer = "index.jsp";
}
response.sendRedirect(referrer);
return;
}
// Error variables
boolean errors = false;
boolean errorUsername = false;
boolean errorPassword = false;
boolean errorConfirmPassword = false;
boolean errorEmail = false;
boolean errorName = false;
boolean errorPasswordMatch = false;
// User creation error vars
boolean errorUserAlreadyExists = false;
// Try creating a user account:
if (create) {
// Validate fields
if (username == null || username.length() < 1) {
errorUsername = true;
}
if (password == null || password.length() < 1) {
errorPassword = true;
}
if (confirmPassword == null || confirmPassword.length() < 1) {
errorConfirmPassword = true;
}
if (email == null) {
errorEmail = true;
}
if (name == null) {
errorName = true;
}
if (!errorPassword && !errorConfirmPassword) {
if (!password.equals(confirmPassword)) {
errorPasswordMatch = true;
}
}
errors = errorUsername || errorPassword || errorConfirmPassword
|| errorEmail || errorName || errorPasswordMatch;
// create an account if there were no errors
if (!errors) {
try {
UserManager userManager = myEnv.getForumFactory().getUserManager();
User user = userManager.createUser(username, password, email);
// Set the name
user.setName( name );
// Set other properties
if (location != null) {
user.setProperty("location", location);
}
if (occupation != null) {
user.setProperty("occupation", occupation);
}
if (homepage != null) {
user.setProperty("homepage", homepage);
}
// Log this user in
SkinUtils.login(request,response,username,password,autoLogin);
// redirect to main page
response.sendRedirect("accountSuccess.jsp");
return;
}
catch (UserAlreadyExistsException uaee) {
errors = true;
errorUserAlreadyExists = true;
}
}
}
%>
<% String title = "論壇 - 創(chuàng)建帳號"; %>
<%@ include file="header.jsp" %>
<% out.flush(); %>
<%-- Breadcrumbs --%>
<font face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.linkColor") %>">
<b>
<a href="<%= JiveGlobals.getJiveProperty("skin.default.homeURL") %>"
>首頁</a>
»
<a href="index.jsp" title="返回論壇列表"
>論壇</a>
»
<a href="account.jsp"
>創(chuàng)建帳號</a>
</b>
</font>
<p>
<font size="-1" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>">
您可以用下面的表單創(chuàng)建新帳號
<b>請注意:黑體標記的表格必須填寫</b>
</font>
<p>
<% if (create && errors) { %>
<font size="-1" color="#ff0000" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>">
<% if (errorUserAlreadyExists) { %>
很抱歉,這個用戶名已經(jīng)存在,請重新選擇.
<% } else if (errorPasswordMatch) { %>
您輸入的密碼不匹配.
<% } else { %>
對不起,注冊出現(xiàn)錯誤,請更正黑體標名的表格
(<font color="#FF0000"><b>*</b></font>).
<% } %>
</font>
<p>
<% }
%>
<form action="account.jsp" method="post" name="userForm">
<input type="hidden" name="create" value="true">
<input type="hidden" name="referrer" value="<%=referrer%>">
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tr>
<td align="right">
<font size="-1" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>">
<b>您的姓名:</b>
<% if (create && errorName) { %>
<font color="#ff0000"><b>*</b></font>
<% } %>
</font>
</td>
<td>
<input type="text" name="name" size="30" maxlength="50" value="<%= (name!=null)?name:"" %>">
<% if (create && errorName) { %>
<br>
<font color="#ff0000" class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>"
>請輸入姓名.</font>
<% } %>
</td>
</tr>
<tr>
<td align="right">
<font class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>">
<b>Email:</b>
<% if (create && errorEmail) { %>
<font color="#ff0000"><b>*</b></font>
<% } %>
</font>
</td>
<td>
<input type="text" name="email" size="30" maxlength="50" value="<%= (email!=null)?email:"" %>">
<% if (create && errorEmail) { %>
<br>
<font color="#ff0000" class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>"
>請輸入一個有效的電子郵件地址.</font>
<% } %>
</td>
</tr>
<tr>
<td align="right">
<font class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>">
<b>用 戶 名:</b>
<% if (create && errorUsername) { %>
<font color="#ff0000"><b>*</b></font>
<% } %>
</font>
</td>
<td>
<input type="text" name="username" size="30" maxlength="50" value="<%= (username!=null)?username:"" %>">
<% if (create && errorUsername) { %>
<br>
<font color="#ff0000" class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>"
>您的用戶名至少2個字符.</font>
<% } %>
</td>
</tr>
<tr>
<td align="right">
<font class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>">
<b>密 碼:</b>
<% if (create && (errorPassword || errorPasswordMatch)) { %>
<font color="#ff0000"><b>*</b></font>
<% } %>
</font>
</td>
<td>
<input type="password" name="password" size="15" maxlength="50" value="<%= (password!=null)?password:"" %>">
<% if (create && errorName) { %>
<br>
<font color="#ff0000" class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>"
>您的密碼至少2個字符.</font>
<% } %>
</td>
</tr>
<tr>
<td align="right">
<font class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>">
<b>確認密碼:</b>
<% if (create && (errorConfirmPassword || errorPasswordMatch)) { %>
<font color="#ff0000"><b>*</b></font>
<% } %>
</font>
</td>
<td>
<input type="password" name="confirmPassword" size="15" maxlength="50" value="<%= (confirmPassword!=null)?confirmPassword:"" %>">
</td>
</tr>
<tr>
<td align="right">
<font class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>">
您的地址:
</font>
</td>
<td>
<input type="text" name="location" size="30" maxlength="50" value="<%= (location!=null)?location:"" %>">
</td>
</tr>
<tr>
<td align="right">
<font class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>">
您的職業(yè):
</font>
</td>
<td>
<input type="text" name="occupation" size="30" maxlength="50" value="<%= (occupation!=null)?occupation:"" %>">
</td>
</tr>
<tr>
<td align="right">
<font class=p2 face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>">
您的主頁:
</font>
</td>
<td>
<input type="text" name="homepage" size="30" maxlength="50" value="<%= (homepage!=null)?homepage:"" %>">
</td>
</tr>
<tr>
<td align="center" colspan="2">
<br>
<input type="submit" name="createButton" value="創(chuàng)建帳號">
<input type="submit" name="createButton" value="取 消">
</td>
</tr>
</table>
<script language="JavaScript" type="text/javascript">
<!--
document.userForm.name.focus();
//-->
</script>
</form>
<br>
<%@ include file="footer.jsp" %>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -