changeset 231:694f959ba3e7

Fixed bad route to /logout controller. Renamed controllers.token to controllers.login because this is what it does.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 26 Jul 2018 13:47:38 +0200
parents 8a226dc1c6ff
children 4859aa6c96be 7d1f0ffdfa41
files controllers/routes.go controllers/token.go
diffstat 2 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/controllers/routes.go	Thu Jul 26 13:39:59 2018 +0200
+++ b/controllers/routes.go	Thu Jul 26 13:47:38 2018 +0200
@@ -16,9 +16,9 @@
 
 	api.Handle("/users", sysAdmin(createUser)).Methods(http.MethodPost)
 
-	api.HandleFunc("/login", token).
+	api.HandleFunc("/login", login).
 		Methods(http.MethodGet, http.MethodPost)
-	api.Handle("/logout", auth.SessionMiddleware(http.HandlerFunc(token))).
+	api.Handle("/logout", auth.SessionMiddleware(http.HandlerFunc(logout))).
 		Methods(http.MethodGet, http.MethodPost)
 	api.Handle("/renew", auth.SessionMiddleware(http.HandlerFunc(renew))).
 		Methods(http.MethodGet, http.MethodPost)
--- a/controllers/token.go	Thu Jul 26 13:39:59 2018 +0200
+++ b/controllers/token.go	Thu Jul 26 13:47:38 2018 +0200
@@ -52,7 +52,7 @@
 	fmt.Fprintln(rw, "token deleted")
 }
 
-func token(rw http.ResponseWriter, req *http.Request) {
+func login(rw http.ResponseWriter, req *http.Request) {
 	user := req.FormValue("user")
 	password := req.FormValue("password")