Skip to content

Commit

Permalink
fix(login): fix new user login in kerberos (zanata#1215)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Eng authored Jun 21, 2016
1 parent c5c9934 commit 9d91c49
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import javax.faces.application.FacesMessage;
import javax.inject.Inject;

import org.apache.commons.lang.StringUtils;
import org.apache.deltaspike.core.api.scope.WindowScoped;
import org.apache.deltaspike.core.util.ContextUtils;
import org.zanata.events.AlreadyLoggedInEvent;
Expand All @@ -55,10 +56,12 @@ public void createSuccessful(@Observes UserCreatedEvent userCreatedEvent) {
}

public void loginInSuccessful(@Observes LoginSuccessfulEvent event) {
log.debug("Account logged in successfully");
if (ContextUtils.isContextActive(WindowScoped.class)) {
facesMessages.addFromResourceBundle(FacesMessage.SEVERITY_INFO,
"authentication.loginSuccessful", event.getName());
if (StringUtils.isNotBlank(event.getName())) {
log.debug("Account logged in successfully");
if (ContextUtils.isContextActive(WindowScoped.class)) {
facesMessages.addFromResourceBundle(FacesMessage.SEVERITY_INFO,
"authentication.loginSuccessful", event.getName());
}
}
}

Expand Down
13 changes: 8 additions & 5 deletions zanata-war/src/main/java/org/zanata/security/ZanataIdentity.java
Original file line number Diff line number Diff line change
Expand Up @@ -614,12 +614,15 @@ private void cacheUserDetails() {
if (cachedPersonName == null) {
HAccount account =
accountDAO.getByUsername(cachedUsername);
HPerson person = account.getPerson();
if (person != null) {
cachedPersonName = person.getName();
cachedPersonEmail = person.getEmail();
if (account != null) {
HPerson person = account.getPerson();
if (person != null) {
cachedPersonName = person.getName();
cachedPersonEmail = person.getEmail();
} else {
cachedPersonEmail = null;
}
} else {
// cachedPersonName = null;
cachedPersonEmail = null;
}
}
Expand Down

0 comments on commit 9d91c49

Please sign in to comment.