📄 accountform.java
字号:
/*
* Copyright 2003-2005 the original author or authors.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.jdon.jivejdon.presentation.form;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionMapping;
import com.jdon.jivejdon.model.Reward;
import com.jdon.model.ModelForm;
/**
* @author <a href="mailto:banqiao@jdon.com">banq </a>
*
*/
public class AccountForm extends BaseForm {
private String userId;
private String email;
private String password;
private String password2;
private String username;
private String roleName;
private String registerCode;
private String passwdanswer;
private String passwdtype;
private boolean emailVisible;
private String creationDate;
private String modifiedDate;
private Reward reward;
private int messageCount;
private boolean authenticated;
public String getEmail() {
return email;
}
public String getPassword() {
return password;
}
public String getPassword2() {
return password2;
}
public void setEmail(String email) {
this.email = email;
}
public void setPassword(String password) {
this.password = password;
}
public void setPassword2(String password2) {
this.password2 = password2;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public String getRegisterCode() {
return registerCode;
}
public void setRegisterCode(String registerCode) {
this.registerCode = registerCode;
}
public String getPasswdtype() {
return passwdtype;
}
public String getPasswdanswer() {
return passwdanswer;
}
public void setPasswdanswer(String passwdanswer) {
this.passwdanswer = passwdanswer;
}
public void setPasswdtype(String passwdtype) {
this.passwdtype = passwdtype;
}
/**
* @return Returns the creationDate.
*/
public String getCreationDate() {
return creationDate;
}
/**
* @param creationDate
* The creationDate to set.
*/
public void setCreationDate(String creationDate) {
this.creationDate = creationDate;
}
/**
* @return Returns the emailVisible.
*/
public boolean isEmailVisible() {
return emailVisible;
}
/**
* @param emailVisible
* The emailVisible to set.
*/
public void setEmailVisible(boolean emailVisible) {
this.emailVisible = emailVisible;
}
/**
* @return Returns the modifiedDate.
*/
public String getModifiedDate() {
return modifiedDate;
}
/**
* @param modifiedDate
* The modifiedDate to set.
*/
public void setModifiedDate(String modifiedDate) {
this.modifiedDate = modifiedDate;
}
/**
* @return Returns the reward.
*/
public Reward getReward() {
return reward;
}
/**
* @param reward
* The reward to set.
*/
public void setReward(Reward reward) {
this.reward = reward;
}
/**
* @return Returns the authenticated.
*/
public boolean isAuthenticated() {
return authenticated;
}
/**
* @param authenticated The authenticated to set.
*/
public void setAuthenticated(boolean authenticated) {
this.authenticated = authenticated;
}
/**
* @return Returns the messageCount.
*/
public int getMessageCount() {
return messageCount;
}
/**
* @param messageCount The messageCount to set.
*/
public void setMessageCount(int messageCount) {
this.messageCount = messageCount;
}
public void doValidate(ActionMapping mapping, HttpServletRequest request, List errors) {
if (ModelForm.EDIT_STR.equals(getAction()) || ModelForm.CREATE_STR.equals(getAction())) {
if (ModelForm.CREATE_STR.equals(getAction())) {
// setStatus("OK");
addErrorIfStringEmpty(errors, "username is required.", getUsername());
if (getPassword() == null || getPassword().length() < 1 || !getPassword().equals(getPassword2())) {
errors.add("Passwords did not match or were not provided. Matching passwords are required.");
}
}
if (getPassword() != null && getPassword().length() > 0) {
if (!getPassword().equals(getPassword2())) {
errors.add("Passwords did not match.");
}
}
addErrorIfStringEmpty(errors, "Email address is required.", getEmail());
if (!SkinUtils.verifyRegisterCode(registerCode, request)) {
errors.add("registerCode dismatch");
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -