mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
cloud user management
This commit is contained in:
+15
-1
@@ -43,7 +43,7 @@ public interface ServiceAPI {
|
||||
* @return "Success" if the operation is successful or error message if it
|
||||
* failed.
|
||||
*/
|
||||
String updateUser(@ParamName("username") String username,
|
||||
String updateUserDetails(@ParamName("username") String username,
|
||||
@ParamName("token") String token,
|
||||
@ParamName("machineId") String machineId,
|
||||
@ParamName("email") String email,
|
||||
@@ -89,6 +89,20 @@ public interface ServiceAPI {
|
||||
@ParamName("token") String token,
|
||||
@ParamName("machineId") String machineId);
|
||||
|
||||
/***
|
||||
* Updates password of the current user using token to authenticate.
|
||||
*
|
||||
* @param username
|
||||
* @param token
|
||||
* @param machineId
|
||||
* @param password
|
||||
* @return "Success" if the login is successful or error message if it
|
||||
* failed.
|
||||
*/
|
||||
String updatePassword(@ParamName("username") String username,
|
||||
@ParamName("oldPassword") String oldPassword,
|
||||
@ParamName("newPassword") String newPassword);
|
||||
|
||||
/***
|
||||
* Searches for projects that meet the specified search criteria. Supports
|
||||
* pagination.
|
||||
|
||||
+33
@@ -179,6 +179,39 @@ public class CloudPresenter {
|
||||
+ res.getClass().getName());
|
||||
}
|
||||
|
||||
public void updatePassword(String oldPassword, String newPassword)
|
||||
throws CloudException {
|
||||
String username = ConfigurationManager.getInstance().readString(
|
||||
USERNAME_KEY, null);
|
||||
|
||||
String res;
|
||||
try {
|
||||
res = service.updatePassword(username, oldPassword, newPassword);
|
||||
} catch (Exception e) {
|
||||
throw new CloudException(e);
|
||||
}
|
||||
if (!res.equals(SUCCESS))
|
||||
throw new CloudException(res);
|
||||
}
|
||||
|
||||
public void updateUserDetails(String email, String website, String bio)
|
||||
throws CloudException {
|
||||
String username = ConfigurationManager.getInstance().readString(
|
||||
USERNAME_KEY, null);
|
||||
String token = ConfigurationManager.getInstance().readString(TOKEN_KEY,
|
||||
null);
|
||||
|
||||
String res;
|
||||
try {
|
||||
res = service.updateUserDetails(username, token, getMachineId(),
|
||||
email, website, bio);
|
||||
} catch (Exception e) {
|
||||
throw new CloudException(e);
|
||||
}
|
||||
if (!res.equals(SUCCESS))
|
||||
throw new CloudException(res);
|
||||
}
|
||||
|
||||
private String getMachineId() {
|
||||
if (machineId == null) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user