32,12 → 32,12 |
|
//If password or user name are empty, the login fails. |
if("".equals(getUserName()) || "".equals(getPw()) || getUserName() == null || getPw() == null) { |
return ERROR; |
return "failed"; |
} |
|
String verifiedUser = verifyUser(getUserName(), getPw()); |
if(verifiedUser.equals("failed")) { |
return ERROR; |
return "failed"; |
} else { |
|
//Put user name, password into session |
64,11 → 64,11 |
|
//User does not exist |
if(u == null) |
return ERROR; |
return "failed"; |
|
//User password does not match |
if(!u.getPassword().equals(password)) |
return ERROR; |
return "failed"; |
|
//User credentials are fine, check for admin rights |
if(u.isAdmin()) { |
98,4 → 98,8 |
public User getModel() { |
return user; |
} |
|
|
|
|
} |