Skip to content

Commit

Permalink
logout: Return to current page when logged out
Browse files Browse the repository at this point in the history
  • Loading branch information
doortts committed Feb 15, 2017
1 parent 5d861ab commit d73aa26
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/controllers/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import jsmessages.JsMessages;
import models.Project;
import models.UserCredential;
import org.apache.commons.lang3.StringUtils;
import play.Logger;
import play.mvc.Controller;
import play.mvc.Http;
Expand All @@ -36,7 +37,8 @@ public static Result oAuth(final String provider) {

public static Result oAuthLogout() {
UserApp.logout();
return logout();
logout();
return returnToReferer();
}

public static Result oAuthDenied(final String providerKey) {
Expand Down Expand Up @@ -104,4 +106,8 @@ public static Result fake() {
// Do not call this.
return badRequest();
}

public static Result returnToReferer() {
return redirect(StringUtils.defaultString(request().getHeader("referer"), index().toString()));
}
}

0 comments on commit d73aa26

Please sign in to comment.