コード例 #1
0
 @Background
 void createAccount(
     String emailAddress, String name, String surname, String userName, String pass) {
   userRESTClient = new UserRESTClient(new BarazkideConnectionData(prefs));
   User user = userRESTClient.getUserByEmailAddress(emailAddress);
   if (!UserUtils.isEmptyUser(user)) { // Retrieve user
     createAccountResult(USER_EXISTS);
     return;
   }
   user = userRESTClient.getUserByScreenName(userName);
   if (!UserUtils.isEmptyUser(user)) { // Retrieve user
     createAccountResult(USER_EXISTS);
     return;
   }
   user =
       userRESTClient.addUser(
           false,
           pass,
           pass,
           false,
           userName,
           emailAddress,
           0,
           "openId",
           "es_ES",
           name,
           null,
           surname,
           1,
           1,
           true,
           1,
           1,
           2000,
           null,
           null,
           null,
           null,
           null,
           true);
   if (!UserUtils.isEmptyUser(user)) { // Check user has been created
     loginUser(user);
     createAccountResult(REGISTER_OK);
   } else {
     createAccountResult(REGISTER_ERROR);
   }
 }
コード例 #2
0
 @UiThread
 void validateUserResult(User user) {
   if (UserUtils.isEmptyUser(user)) {
     prefs.user().put("");
     prefs.pass().put("");
     Toast.makeText(this, "Incorrect user or password.", Toast.LENGTH_SHORT).show();
   } else {
     loginUser(user);
     BarazkideCache.init(prefs);
     UserCache.init(prefs);
     finish();
     GardensActivity_.intent(this).start();
   }
   dialog.cancel();
 }