From 8e8e67666cf94f7968e53bdd9c4fee69ab42b2d0 Mon Sep 17 00:00:00 2001 From: Steve Date: Tue, 2 Mar 2021 15:03:56 -0500 Subject: [PATCH] lower case usernames --- session.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/session.go b/session.go index 95f1015..cf9355a 100644 --- a/session.go +++ b/session.go @@ -3,6 +3,7 @@ package main import ( "log" "net/http" + "strings" ) func setSession(uname string, res http.ResponseWriter) { @@ -57,7 +58,7 @@ func signup(res http.ResponseWriter, req *http.Request) { } //insert into LDAP log.Printf("Attempting to create account for %v", username) - err := createLDAPAccount(username, password, email) + err := createLDAPAccount(strings.ToLower(username), password, email) if err == nil { genericSuccessPage(res, "User Created", "Unregistered", false, "User created") return @@ -68,7 +69,7 @@ func signup(res http.ResponseWriter, req *http.Request) { } func login(res http.ResponseWriter, req *http.Request) { - username := req.FormValue("username") + username := strings.ToLower(req.FormValue("username")) password := req.FormValue("password") log.Printf("Attempting login for user %v\n", username) err := loginLDAPAccount(username, password)