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(); }
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(); }
public UserAccountsMyAccountPage(VitroRequest vreq) { super(vreq); this.userAccount = LoginStatusBean.getCurrentUser(vreq); this.strategy = UserAccountsMyAccountPageStrategy.getInstance(vreq, this, isExternalAccount()); parseRequestParameters(); if (isSubmit()) { validateParameters(); } }
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(); } }
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); }