Added login for estate agents
Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
@ -51,7 +51,12 @@ public class Main {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MENU_ESTATES:
|
case MENU_ESTATES:
|
||||||
|
if (loginEstateAgent()) {
|
||||||
showEstateMenu();
|
showEstateMenu();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
System.out.println("The username or password was wrong.");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case QUIT:
|
case QUIT:
|
||||||
return;
|
return;
|
||||||
@ -69,6 +74,19 @@ public class Main {
|
|||||||
return sudoPassword.equals(passwordInput);
|
return sudoPassword.equals(passwordInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs a login for an estate agent.
|
||||||
|
*
|
||||||
|
* @return true if the login is successful, false otherwise
|
||||||
|
*/
|
||||||
|
private static boolean loginEstateAgent() {
|
||||||
|
System.out.println("Please insert the username and password of a valid estate agent.");
|
||||||
|
String username = FormUtil.readString("Username");
|
||||||
|
String passwordInput = FormUtil.readPassword();
|
||||||
|
EstateAgent agent = _orm.get(username);
|
||||||
|
return agent != null && agent.getPassword().equals(passwordInput);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Shows the estate management.
|
* TODO Shows the estate management.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user