From f95b916652bf0cd02da0daedf6bfc647d4b32ca7 Mon Sep 17 00:00:00 2001 From: Niall Sheridan Date: Wed, 20 Apr 2016 00:44:26 +0100 Subject: use a better function name --- server/main.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'server') diff --git a/server/main.go b/server/main.go index 0125ca8..f90037b 100644 --- a/server/main.go +++ b/server/main.go @@ -112,7 +112,7 @@ func signHandler(a *appContext, w http.ResponseWriter, r *http.Request) (int, er } func loginHandler(a *appContext, w http.ResponseWriter, r *http.Request) (int, error) { - a.authsession = a.authprovider.StartSession(hex.EncodeToString(random(32))) + a.authsession = a.authprovider.StartSession(newState(32)) http.Redirect(w, r, a.authsession.AuthURL, http.StatusFound) return http.StatusFound, nil } @@ -170,12 +170,12 @@ func (ah appHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } } -func random(length int) []byte { - k := make([]byte, length) +func newState() string { + k := make([]byte, 32) if _, err := io.ReadFull(rand.Reader, k); err != nil { - return nil + return "unexpectedstring" } - return k + return hex.EncodeToString(k) } func main() { -- cgit v1.2.3