Redirect from /login to /admin if user is already logged in
This commit is contained in:
parent
e128680e9a
commit
1456ac5341
|
@ -89,7 +89,11 @@ func (h *App) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
case "login":
|
case "login":
|
||||||
switch r.Method {
|
switch r.Method {
|
||||||
case http.MethodGet:
|
case http.MethodGet:
|
||||||
serveLoginForm(w, r, user, company, "/admin")
|
if user.LoggedIn {
|
||||||
|
httplib.Redirect(w, r, "/admin", http.StatusFound)
|
||||||
|
} else {
|
||||||
|
serveLoginForm(w, r, user, company, "/admin")
|
||||||
|
}
|
||||||
case http.MethodPost:
|
case http.MethodPost:
|
||||||
handleLogin(w, r, user, company, conn)
|
handleLogin(w, r, user, company, conn)
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue