| |
---|
| | } |
---|
| | return theInstance; |
---|
| | } |
---|
| | |
---|
| | public URIAddressedEntity createAcount(String userID, String userName, String userPass) { |
---|
| | public URIAddressedAccount createAcount(String userID, String userName, String userPass) { |
---|
| | if (!userIDSet.add(userID)) |
---|
| | return null; |
---|
| | String uniqueID = RandomStringGenerator.generateUniqueString(12, RandomStringGenerator.ALPHA_NUMERIC, |
---|
| | uniqueIDSet); |
---|
| | uniqueIDSet.add(uniqueID); |
---|
| | Account newAccount = new Account(userID, userName, userPass, uniqueID); |
---|
| | accounts.add(newAccount); |
---|
| | return new URIAddressedEntity("/CactusServer/rest/accounts/" + uniqueID, newAccount); |
---|
| | return new URIAddressedAccount("/CactusServer/rest/accounts/" + uniqueID, newAccount); |
---|
| | } |
---|
| | |
---|
| | public Account getAccountToken(String token) { |
---|
| | Account editAccount; |
---|
| |
---|
| | } |
---|
| | return null; |
---|
| | } |
---|
| | |
---|
| | public URIAddressedEntity loginAccount(String userID, String userPass) { |
---|
| | public URIAddressedAccount 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(); |
---|
| | return new URIAddressedEntity( |
---|
| | return new URIAddressedAccount( |
---|
| | "/CactusServer/rest/accounts/" + Accounts.getInstance().getAccountByID(userID).getUniqueID(), |
---|
| | Accounts.getInstance().getAccountByID(userID)); |
---|
| | } else { |
---|
| | return null; |
---|
| |
---|
| | |