You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Demo1/src/RegisteredUser.java

57 lines
1.3 KiB

/**
* 注册用户类
* 存储用户注册信息和密码
*/
public class RegisteredUser {
private String email;
private String password;
private String verificationCode;
private boolean isVerified;
public RegisteredUser(String email, String verificationCode) {
this.email = email;
this.verificationCode = verificationCode;
this.isVerified = false;
}
public String getEmail() {
return email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getVerificationCode() {
return verificationCode;
}
public boolean isVerified() {
return isVerified;
}
public void setVerified(boolean verified) {
isVerified = verified;
}
public boolean verifyCode(String code) {
return verificationCode.equals(code);
}
public boolean verifyPassword(String password) {
return this.password != null && this.password.equals(password);
}
@Override
public String toString() {
return "RegisteredUser{" +
"email='" + email + '\'' +
", isVerified=" + isVerified +
'}';
}
}