Skip to content

Commit 5d6f823

Browse files
author
raul-brainattica
committed
Bugs fixed
1 parent 8a3eb05 commit 5d6f823

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

controllers/auth_controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func Login(w http.ResponseWriter, r *http.Request) {
1818
w.Write(token)
1919
}
2020

21-
func RefresfhToken(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
21+
func RefreshToken(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
2222
requestUser := new(models.User)
2323
decoder := json.NewDecoder(r.Body)
2424
decoder.Decode(&requestUser)

routers/authentication.go

+10-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@ import (
99

1010
func SetAuthenticationRoutes(router *mux.Router) *mux.Router {
1111
router.HandleFunc("/token-auth", controllers.Login).Methods("POST")
12-
router.Handle("/refresh-token-auth", negroni.New(negroni.HandlerFunc(authentication.RequireTokenAuthentication), negroni.HandlerFunc(controllers.RefresfhToken))).Methods("GET")
13-
router.Handle("/logout", negroni.New(negroni.HandlerFunc(authentication.RequireTokenAuthentication), negroni.HandlerFunc(controllers.Logout))).Methods("GET")
12+
router.Handle("/refresh-token-auth",
13+
negroni.New(
14+
negroni.HandlerFunc(authentication.RequireTokenAuthentication),
15+
negroni.HandlerFunc(controllers.RefreshToken),
16+
)).Methods("GET")
17+
router.Handle("/logout",
18+
negroni.New(
19+
negroni.HandlerFunc(authentication.RequireTokenAuthentication),
20+
negroni.HandlerFunc(controllers.Logout),
21+
)).Methods("GET")
1422
return router
1523
}

routers/hello.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ import (
88
)
99

1010
func SetHelloRoutes(router *mux.Router) *mux.Router {
11-
router.Handle("/test/hello", negroni.New(negroni.HandlerFunc(authentication.RequireTokenAuthentication), negroni.HandlerFunc(controllers.HelloController))).Methods("GET")
11+
router.Handle("/test/hello",
12+
negroni.New(
13+
negroni.HandlerFunc(authentication.RequireTokenAuthentication),
14+
negroni.HandlerFunc(controllers.HelloController),
15+
)).Methods("GET")
16+
1217
return router
1318
}

services/models/users.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ package models
22

33
type User struct {
44
UUID string `json:"uuid" form:"-"`
5-
Username string `json:"username" form:"username""`
5+
Username string `json:"username" form:"username"`
66
Password string `json:"password" form:"password"`
77
}

0 commit comments

Comments
 (0)