NIHVIVO-736 Removed unused code and little-used code from the LoginFormBean
This commit is contained in:
parent
3300b7cda7
commit
57cbc5f1e0
2 changed files with 14 additions and 91 deletions
|
@ -2,8 +2,6 @@
|
|||
|
||||
package edu.cornell.mannlib.vedit.beans;
|
||||
|
||||
import java.util.Hashtable;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
|
@ -14,83 +12,30 @@ import javax.servlet.http.HttpSession;
|
|||
*/
|
||||
public class LoginFormBean {
|
||||
public static final int ANYBODY = 0;
|
||||
|
||||
public int getAnybody() {
|
||||
return ANYBODY;
|
||||
}
|
||||
|
||||
public static final int NON_EDITOR = 1;
|
||||
|
||||
public int getNonEditor() {
|
||||
return NON_EDITOR;
|
||||
}
|
||||
|
||||
public static final int EDITOR = 4;
|
||||
|
||||
public int getEditor() {
|
||||
return EDITOR;
|
||||
}
|
||||
|
||||
public static final int CURATOR = 5;
|
||||
|
||||
public int getCurator() {
|
||||
return CURATOR;
|
||||
}
|
||||
|
||||
public static final int DBA = 50;
|
||||
|
||||
public int getDba() {
|
||||
return DBA;
|
||||
}
|
||||
|
||||
public boolean getBla() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private String userURI;
|
||||
private String sessionId;
|
||||
private String loginBrowser;
|
||||
private String loginRemoteAddr;
|
||||
private String loginName;
|
||||
private String loginPassword;
|
||||
private String loginStatus;
|
||||
private int loginUserId;
|
||||
private String loginRole;
|
||||
private String duplicatePassword;
|
||||
private String emailAddress;
|
||||
private Hashtable<String, String> errors;
|
||||
|
||||
public boolean validateLoginForm() {
|
||||
boolean allOk = true;
|
||||
|
||||
if (loginName.equals("")) {
|
||||
errors.put("loginName", "Please enter your Vivo user name");
|
||||
loginName = "";
|
||||
allOk = false;
|
||||
}
|
||||
|
||||
if (loginPassword.equals("")) {
|
||||
errors.put("loginPassword", "Please enter your Vivo password");
|
||||
loginPassword = "";
|
||||
allOk = false;
|
||||
}
|
||||
|
||||
return allOk;
|
||||
}
|
||||
|
||||
public LoginFormBean() {
|
||||
sessionId = "";
|
||||
loginBrowser = "";
|
||||
loginRemoteAddr = "";
|
||||
loginName = "";
|
||||
loginPassword = "";
|
||||
loginStatus = "none";
|
||||
loginUserId = 0;
|
||||
loginRole = "1";
|
||||
duplicatePassword = "";
|
||||
emailAddress = "";
|
||||
|
||||
errors = new Hashtable<String, String>();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
@ -124,14 +69,17 @@ public class LoginFormBean {
|
|||
}
|
||||
|
||||
public static boolean loggedIn(HttpServletRequest request, int minLevel) {
|
||||
if (request == null)
|
||||
if (request == null) {
|
||||
return false;
|
||||
}
|
||||
HttpSession sess = request.getSession(false);
|
||||
if (sess == null)
|
||||
if (sess == null) {
|
||||
return false;
|
||||
}
|
||||
Object obj = sess.getAttribute("loginHandler");
|
||||
if (obj == null || !(obj instanceof LoginFormBean))
|
||||
if (!(obj instanceof LoginFormBean)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
LoginFormBean lfb = (LoginFormBean) obj;
|
||||
return ("authenticated".equals(lfb.loginStatus) && Integer
|
||||
|
@ -160,10 +108,6 @@ public class LoginFormBean {
|
|||
return loginName;
|
||||
}
|
||||
|
||||
public String getLoginPassword() {
|
||||
return loginPassword;
|
||||
}
|
||||
|
||||
public String getLoginStatus() {
|
||||
return loginStatus;
|
||||
}
|
||||
|
@ -176,19 +120,10 @@ public class LoginFormBean {
|
|||
return loginRole;
|
||||
}
|
||||
|
||||
public String getDuplicatePassword() {
|
||||
return duplicatePassword;
|
||||
}
|
||||
|
||||
public String getEmailAddress() {
|
||||
return emailAddress;
|
||||
}
|
||||
|
||||
public String getErrorMsg(String s) {
|
||||
String errorMsg = (String) errors.get(s.trim());
|
||||
return (errorMsg == null) ? "" : errorMsg;
|
||||
}
|
||||
|
||||
/********************** SET METHODS *********************/
|
||||
|
||||
public void setUserURI(String uri) {
|
||||
|
@ -211,10 +146,6 @@ public class LoginFormBean {
|
|||
loginName = ln;
|
||||
}
|
||||
|
||||
public void setLoginPassword(String lp) {
|
||||
loginPassword = lp;
|
||||
}
|
||||
|
||||
public void setLoginStatus(String ls) {
|
||||
loginStatus = ls;
|
||||
}
|
||||
|
@ -227,16 +158,8 @@ public class LoginFormBean {
|
|||
loginRole = lr;
|
||||
}
|
||||
|
||||
public void setDuplicatePassword(String dp) {
|
||||
duplicatePassword = dp;
|
||||
}
|
||||
|
||||
public void setEmailAddress(String ea) {
|
||||
emailAddress = ea;
|
||||
}
|
||||
|
||||
public void setErrorMsg(String key, String msg) {
|
||||
errors.put(key, msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue