lower case usernames

This commit is contained in:
stryan 2021-03-02 15:03:56 -05:00
parent a1c3b66705
commit 8e8e67666c

View File

@ -3,6 +3,7 @@ package main
import ( import (
"log" "log"
"net/http" "net/http"
"strings"
) )
func setSession(uname string, res http.ResponseWriter) { func setSession(uname string, res http.ResponseWriter) {
@ -57,7 +58,7 @@ func signup(res http.ResponseWriter, req *http.Request) {
} }
//insert into LDAP //insert into LDAP
log.Printf("Attempting to create account for %v", username) log.Printf("Attempting to create account for %v", username)
err := createLDAPAccount(username, password, email) err := createLDAPAccount(strings.ToLower(username), password, email)
if err == nil { if err == nil {
genericSuccessPage(res, "User Created", "Unregistered", false, "User created") genericSuccessPage(res, "User Created", "Unregistered", false, "User created")
return return
@ -68,7 +69,7 @@ func signup(res http.ResponseWriter, req *http.Request) {
} }
func login(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") password := req.FormValue("password")
log.Printf("Attempting login for user %v\n", username) log.Printf("Attempting login for user %v\n", username)
err := loginLDAPAccount(username, password) err := loginLDAPAccount(username, password)