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