Skip to content
This repository has been archived by the owner on May 23, 2019. It is now read-only.

Commit

Permalink
Update #237
Browse files Browse the repository at this point in the history
  • Loading branch information
hdsdi3g committed Feb 24, 2017
1 parent c67cef5 commit eff5618
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions app/controllers/Secure.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,20 +233,35 @@ public static void authenticate(@Required String username, @Required String pass

Cache.set("user:" + username + ":privileges", authuser.getUser_groups_roles_privileges(), Bootstrap.getSessionTTL());

Loggers.Play.info("User has a successful authentication: " + getUserSessionInformation());
String long_name = authuser.getFullname();
if (long_name == null) {
long_name = authuser.getName();
}

Loggers.Play.info(long_name + " has a successful authentication, with privileges: " + getSessionPrivileges().toString() + ". User key: " + username);

redirect("Application.index");
}

public static void logout() throws Throwable {
try {
Loggers.Play.info("User went tries to sign off: " + getUserSessionInformation());

String username = connected();
if (username != null) {
Cache.delete("user:" + username + ":privileges");
}
session.clear();

UserNG user = Bootstrap.getAuth().getByUserKey(username);
if (user == null) {
Loggers.Play.info("User " + username + " went tries to sign off.");
} else {
String long_name = user.getFullname();
if (long_name == null) {
long_name = user.getName();
}
Loggers.Play.info(long_name + " went tries to sign off.");
}

} catch (Exception e) {
Loggers.Play.error("Error during sign off: " + getUserSessionInformation());
throw e;
Expand Down

0 comments on commit eff5618

Please sign in to comment.