Skip to content

Commit

Permalink
login: Update login user check logic
Browse files Browse the repository at this point in the history
  • Loading branch information
doortts committed Sep 3, 2017
1 parent f88d416 commit ece3c7d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions app/controllers/UserApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ private static User getUserFromSession() {
if ((userKey != null && Long.valueOf(userId) != null)){
user = CacheStore.yonaUsers.getIfPresent(Long.valueOf(userId));
}
if (user == null) {
if (user == null || user.isLocked()) {
return invalidSession();
}
return user;
Expand All @@ -664,7 +664,14 @@ private static User getUserFromContext() {
return (User) cached;
}
initTokenUser();
return (User) Http.Context.current().args.get(TOKEN_USER);
User foundUser = (User) Http.Context.current().args.get(TOKEN_USER);

if(foundUser.isLocked()) {
processLogout();
return User.anonymous;
}

return foundUser;
}

public static void initTokenUser() {
Expand Down Expand Up @@ -692,7 +699,7 @@ private static User getUserFromToken() {
}

private static User invalidSession() {
session().clear();
processLogout();
return User.anonymous;
}

Expand Down

0 comments on commit ece3c7d

Please sign in to comment.