| |
---|
| | public Account getAccountByuniqueID(String uniqueID) { |
---|
| | Account editAccount; |
---|
| | for (int i = 0; i < accounts.size(); i++) { |
---|
| | editAccount = accounts.get(i); |
---|
| | if (editAccount.getuniqueID().equals(uniqueID)) { |
---|
| | if (editAccount.getUniqueID().equals(uniqueID)) { |
---|
| | return editAccount; |
---|
| | } |
---|
| | } |
---|
| | return null; |
---|
| | } |
---|
| | |
---|
| | public Session loginAccount(String userID, String userPass) { |
---|
| | if (getAccountByID(userID).getpass().equals(userPass)) { |
---|
| | if (getAccountByID(userID).getPass().equals(userPass)) { |
---|
| | Accounts.getInstance().getAccountByID(userID).setLogin(true); |
---|
| | Accounts.getInstance().getAccountByID(userID).formToken(); |
---|
| | session = new Session(Accounts.getInstance().getAccountByID(userID), URI.create( |
---|
| | "/CactusServer/rest/accounts/" + Accounts.getInstance().getAccountByID(userID).getuniqueID())); |
---|
| | "/CactusServer/rest/accounts/" + Accounts.getInstance().getAccountByID(userID).getUniqueID())); |
---|
| | return session; |
---|
| | } else { |
---|
| | return null; |
---|
| | } |
---|
| |
---|
| | |
---|
| | public Account deleteAccount(String token) { |
---|
| | Account edit = Accounts.getInstance().getAccountToken(token); |
---|
| | userIDSet.remove(edit.getId()); |
---|
| | uniqueIDSet.remove(edit.getuniqueID()); |
---|
| | uniqueIDSet.remove(edit.getUniqueID()); |
---|
| | accounts.remove(edit); |
---|
| | return edit; |
---|
| | } |
---|
| | |
---|
| |
---|
| | |