Skip to content

Commit

Permalink
Fix open redirection
Browse files Browse the repository at this point in the history
  • Loading branch information
s-gv committed Mar 3, 2018
1 parent 3f73f96 commit 1f6313c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions views/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

var LoginHandler = UA(func(w http.ResponseWriter, r *http.Request, sess Session) {
redirectURL, err := url.QueryUnescape(r.FormValue("next"))
if redirectURL == "" || err != nil {
if err != nil || redirectURL == "" || redirectURL[0] != '/' {
redirectURL = "/"
}
if sess.IsUserValid() {
Expand Down Expand Up @@ -59,7 +59,7 @@ func LogoutHandler(w http.ResponseWriter, r *http.Request) {

var SignupHandler = UA(func(w http.ResponseWriter, r *http.Request, sess Session) {
redirectURL, err := url.QueryUnescape(r.FormValue("next"))
if redirectURL == "" || err != nil {
if err != nil || redirectURL == "" || redirectURL[0] != '/' {
redirectURL = "/"
}
if sess.IsUserValid() && !sess.IsUserSuperAdmin() {
Expand Down

0 comments on commit 1f6313c

Please sign in to comment.