Exemplo n.º 1
0
  public void updateAccount() {
    userAccount.setEmailAddress(emailAddress);
    userAccount.setFirstName(firstName);
    userAccount.setLastName(lastName);

    Individual profilePage = getProfilePage(userAccount);
    if (profilePage != null) {
      userAccountsDao.setProxyAccountsOnProfile(profilePage.getURI(), proxyUris);
    }

    strategy.setAdditionalProperties(userAccount);

    userAccountsDao.updateUserAccount(userAccount);

    strategy.notifyUser();
    confirmationCode = strategy.getConfirmationCode();
  }
Exemplo n.º 2
0
  private void parseRequestParameters() {
    submit = isFlagOnRequest(PARAMETER_SUBMIT);
    emailAddress = getStringParameter(PARAMETER_EMAIL_ADDRESS, "");
    firstName = getStringParameter(PARAMETER_FIRST_NAME, "");
    lastName = getStringParameter(PARAMETER_LAST_NAME, "");
    proxyUris = getStringParameters(PARAMETER_PROXY_URI);

    strategy.parseAdditionalParameters();
  }
Exemplo n.º 3
0
  public UserAccountsMyAccountPage(VitroRequest vreq) {
    super(vreq);

    this.userAccount = LoginStatusBean.getCurrentUser(vreq);
    this.strategy = UserAccountsMyAccountPageStrategy.getInstance(vreq, this, isExternalAccount());

    parseRequestParameters();

    if (isSubmit()) {
      validateParameters();
    }
  }
Exemplo n.º 4
0
 private void validateParameters() {
   if (emailAddress.isEmpty()) {
     errorCode = ERROR_NO_EMAIL;
   } else if (emailIsChanged() && isEmailInUse()) {
     errorCode = ERROR_EMAIL_IN_USE;
   } else if (!isEmailValidFormat()) {
     errorCode = ERROR_EMAIL_INVALID_FORMAT;
   } else if (firstName.isEmpty()) {
     errorCode = ERROR_NO_FIRST_NAME;
   } else if (lastName.isEmpty()) {
     errorCode = ERROR_NO_LAST_NAME;
   } else {
     errorCode = strategy.additionalValidations();
   }
 }
Exemplo n.º 5
0
  public final ResponseValues showPage() {
    Map<String, Object> body = new HashMap<String, Object>();

    if (isSubmit()) {
      body.put("emailAddress", emailAddress);
      body.put("firstName", firstName);
      body.put("lastName", lastName);
      body.put("proxies", buildOngoingProxyList());
    } else {
      body.put("emailAddress", userAccount.getEmailAddress());
      body.put("firstName", userAccount.getFirstName());
      body.put("lastName", userAccount.getLastName());
      body.put("proxies", buildOriginalProxyList());
    }
    body.put("formUrls", buildUrlsMap());
    body.put("myAccountUri", userAccount.getUri());
    body.put("profileTypes", buildProfileTypesString());

    // Could I do this without exposing this mechanism? But how to search
    // for an associated profile in AJAX?
    body.put("matchingProperty", SelfEditingConfiguration.getBean(vreq).getMatchingPropertyUri());

    if (userAccount.isExternalAuthOnly()) {
      body.put("externalAuthOnly", Boolean.TRUE);
    }
    if (!errorCode.isEmpty()) {
      body.put(errorCode, Boolean.TRUE);
    }
    if (!confirmationCode.isEmpty()) {
      body.put(confirmationCode, Boolean.TRUE);
    }
    if (isProxyPanelAuthorized()) {
      body.put("showProxyPanel", Boolean.TRUE);
    }

    strategy.addMoreBodyValues(body);

    return new TemplateResponseValues(TEMPLATE_NAME, body);
  }