Skip to content

Commit

Permalink
Bugs fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
raul-brainattica committed May 29, 2015
1 parent 8a3eb05 commit 5d6f823
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion controllers/auth_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func Login(w http.ResponseWriter, r *http.Request) {
w.Write(token)
}

func RefresfhToken(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
func RefreshToken(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
requestUser := new(models.User)
decoder := json.NewDecoder(r.Body)
decoder.Decode(&requestUser)
Expand Down
12 changes: 10 additions & 2 deletions routers/authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ import (

func SetAuthenticationRoutes(router *mux.Router) *mux.Router {
router.HandleFunc("/token-auth", controllers.Login).Methods("POST")
router.Handle("/refresh-token-auth", negroni.New(negroni.HandlerFunc(authentication.RequireTokenAuthentication), negroni.HandlerFunc(controllers.RefresfhToken))).Methods("GET")
router.Handle("/logout", negroni.New(negroni.HandlerFunc(authentication.RequireTokenAuthentication), negroni.HandlerFunc(controllers.Logout))).Methods("GET")
router.Handle("/refresh-token-auth",
negroni.New(
negroni.HandlerFunc(authentication.RequireTokenAuthentication),
negroni.HandlerFunc(controllers.RefreshToken),
)).Methods("GET")
router.Handle("/logout",
negroni.New(
negroni.HandlerFunc(authentication.RequireTokenAuthentication),
negroni.HandlerFunc(controllers.Logout),
)).Methods("GET")
return router
}
7 changes: 6 additions & 1 deletion routers/hello.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import (
)

func SetHelloRoutes(router *mux.Router) *mux.Router {
router.Handle("/test/hello", negroni.New(negroni.HandlerFunc(authentication.RequireTokenAuthentication), negroni.HandlerFunc(controllers.HelloController))).Methods("GET")
router.Handle("/test/hello",
negroni.New(
negroni.HandlerFunc(authentication.RequireTokenAuthentication),
negroni.HandlerFunc(controllers.HelloController),
)).Methods("GET")

return router
}
2 changes: 1 addition & 1 deletion services/models/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ package models

type User struct {
UUID string `json:"uuid" form:"-"`
Username string `json:"username" form:"username""`
Username string `json:"username" form:"username"`
Password string `json:"password" form:"password"`
}

0 comments on commit 5d6f823

Please sign in to comment.