Beispiel #1
0
  /** Is there an Individual associated with this user? */
  private String getAssociatedIndividualUri() {
    UserAccount userAccount = LoginStatusBean.getCurrentUser(request);
    if (userAccount == null) {
      log.debug("Not logged in? Must be cancelling the password change");
      return null;
    }

    List<String> uris = Authenticator.getInstance(request).getAssociatedIndividualUris(userAccount);
    if (uris.isEmpty()) {
      log.debug("'" + userAccount.getEmailAddress() + "' is not associated with an individual.");
      return null;
    } else {
      String uri = uris.get(0);
      log.debug("'" + userAccount.getEmailAddress() + "' is associated with an individual: " + uri);
      return uri;
    }
  }
Beispiel #2
0
  public String assembleWelcomeMessage() {
    if (!canSeeSiteAdminPage() && !isSelfEditorWithIndividual()) {
      // A special message for unrecognized self-editors:
      return i18n.text("logged_in_but_no_profile");
    }

    String greeting = i18n.text("unknown_user_name");
    int loginCount = 0;

    UserAccount userAccount = LoginStatusBean.getCurrentUser(request);
    if (userAccount != null) {
      loginCount = userAccount.getLoginCount();
      if (StringUtils.isNotEmpty(userAccount.getFirstName())) {
        greeting = userAccount.getFirstName();
      } else if (StringUtils.isNotEmpty(userAccount.getEmailAddress())) {
        greeting = userAccount.getEmailAddress();
      }
    }

    return i18n.text("login_welcome_message", greeting, loginCount);
  }
  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);
  }
 private boolean emailIsChanged() {
   return !emailAddress.equals(userAccount.getEmailAddress());
 }