Mercurial > gemma
comparison pkg/controllers/token.go @ 536:d9dbb6139760
Log errors in JSON handler and login controller.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 29 Aug 2018 11:22:04 +0200 |
parents | 7474e9922ed5 |
children | 7934b5c1a910 |
comparison
equal
deleted
inserted
replaced
535:da5f47a0941c | 536:d9dbb6139760 |
---|---|
23 switch { | 23 switch { |
24 case err == auth.ErrNoSuchToken: | 24 case err == auth.ErrNoSuchToken: |
25 http.NotFound(rw, req) | 25 http.NotFound(rw, req) |
26 return | 26 return |
27 case err != nil: | 27 case err != nil: |
28 log.Printf("error: %v\n", err) | |
28 http.Error(rw, fmt.Sprintf("error: %v", err), http.StatusInternalServerError) | 29 http.Error(rw, fmt.Sprintf("error: %v", err), http.StatusInternalServerError) |
29 return | 30 return |
30 } | 31 } |
31 | 32 |
32 session, _ := auth.GetSession(req) | 33 session, _ := auth.GetSession(req) |
76 | 77 |
77 token, session, err := auth.GenerateSession( | 78 token, session, err := auth.GenerateSession( |
78 string(input.User), | 79 string(input.User), |
79 input.Password) | 80 input.Password) |
80 if err != nil { | 81 if err != nil { |
82 log.Printf("error: %v\n", err) | |
81 http.Error(rw, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized) | 83 http.Error(rw, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized) |
82 return | 84 return |
83 } | 85 } |
84 | 86 |
85 var result = struct { | 87 var result = struct { |