create user functionality

This commit is contained in:
Branislav Stojkovic
2016-10-22 20:58:53 +02:00
parent ff019542f8
commit 71534e065b
2 changed files with 18 additions and 2 deletions
@@ -158,6 +158,20 @@ public class CloudPresenter {
}
public void createUserAccount(String username, String password,
String email, String website, String bio) throws CloudException {
try {
String res = service.createUser(username, password, email, website,
bio);
if (res == null)
throw new CloudException("Could not create user account.");
if (!SUCCESS.equals(res))
throw new CloudException(res);
} catch (Exception e) {
throw new CloudException(e);
}
}
public UserEntity getUserDetails() throws CloudException {
String username = ConfigurationManager.getInstance().readString(
USERNAME_KEY, null);
@@ -258,7 +258,7 @@ public class CloudPlugIn implements IPlugIn, CloudListener {
@Override
public void actionPerformed(ActionEvent e) {
UserEditDialog dialog = DialogFactory.getInstance()
final UserEditDialog dialog = DialogFactory.getInstance()
.createUserEditDialog(null);
dialog.setVisible(true);
if (ButtonDialog.OK.equals(dialog.getSelectedButtonCaption())) {
@@ -266,7 +266,9 @@ public class CloudPlugIn implements IPlugIn, CloudListener {
@Override
public Void doInBackground() throws Exception {
cloudPresenter.createUserAccount(dialog.getUserName(),
dialog.getPassword(), dialog.getEmail(),
dialog.getWebsite(), dialog.getBio());
return null;
}