login-validator: Refactor, search csv in /data dir

This commit is contained in:
nemunaire 2023-02-25 14:42:40 +01:00
commit 50ad1f0712
4 changed files with 16 additions and 12 deletions

View file

@ -52,7 +52,7 @@ func main() {
log.Fatal(err)
}
var lc loginChecker
lc := &loginChecker{}
if auth != nil && *auth == "ldap" {
log.Printf("Auth method: LDAP(%s@%s:%d?%s)", *ldapbindusername, *ldapAddr, *ldapPort, *ldapbase)
@ -87,6 +87,7 @@ func main() {
if err != nil {
log.Fatal(err)
}
log.Printf("%d students loaded", len(lc.students))
// Prepare graceful shutdown
interrupt := make(chan os.Signal, 1)
@ -100,7 +101,7 @@ func main() {
log.Println("Registering handlers...")
mux := http.NewServeMux()
mux.Handle("/login", &lc)
mux.Handle("/login", lc)
mux.HandleFunc("/logout", logout)
mux.HandleFunc("/passwd", passwd)
http.HandleFunc("/", mux.ServeHTTP)