| |
---|
| | private static Accounts theInstance = null; |
---|
| | private ArrayList<Account> accounts = new ArrayList<>(ACCOUNT_NUM_MAX); |
---|
| | private HashSet<String> userIDSet = new HashSet<>(ACCOUNT_NUM_MAX); |
---|
| | private HashSet<String> uniqueIDSet = new HashSet<>(ACCOUNT_NUM_MAX); |
---|
| | private URIAddressedEntity session; |
---|
| | |
---|
| | |
---|
| | private Accounts() { |
---|
| | |
---|
| | } |
---|
| | |
---|
| |
---|
| | uniqueIDSet); |
---|
| | uniqueIDSet.add(uniqueID); |
---|
| | Account newAccount = new Account(userID, userName, userPass, uniqueID); |
---|
| | accounts.add(newAccount); |
---|
| | session = new URIAddressedEntity("/CactusServer/rest/accounts/" + uniqueID, newAccount); |
---|
| | |
---|
| | return session; |
---|
| | return new URIAddressedEntity("/CactusServer/rest/accounts/" + uniqueID, newAccount); |
---|
| | } |
---|
| | |
---|
| | public Account getAccountToken(String token) { |
---|
| | Account editAccount; |
---|
| |
---|
| | public URIAddressedEntity loginAccount(String userID, String userPass) { |
---|
| | if (getAccountByID(userID) != null && getAccountByID(userID).getPass().equals(userPass)) { |
---|
| | Accounts.getInstance().getAccountByID(userID).setLogin(true); |
---|
| | Accounts.getInstance().getAccountByID(userID).formToken(); |
---|
| | session = new URIAddressedEntity( |
---|
| | return new URIAddressedEntity( |
---|
| | "/CactusServer/rest/accounts/" + Accounts.getInstance().getAccountByID(userID).getUniqueID(), |
---|
| | Accounts.getInstance().getAccountByID(userID)); |
---|
| | return session; |
---|
| | } else { |
---|
| | return null; |
---|
| | } |
---|
| | } |
---|
| |
---|
| | |