diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2023-09-26 08:40:41 +0200 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2023-09-26 08:40:41 +0200 |
commit | 706ff58a6f6608719feda15075d50f978df39c5b (patch) | |
tree | d0b655454d5e13ed2238060fee27fc0d951d64c8 /main.go | |
parent | d8633d7fb89b55996f25e1a67180408c805ba15f (diff) | |
download | guichet-706ff58a6f6608719feda15075d50f978df39c5b.tar.gz guichet-706ff58a6f6608719feda15075d50f978df39c5b.zip |
format
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 23 |
1 files changed, 11 insertions, 12 deletions
@@ -119,13 +119,13 @@ func main() { } switch os.Args[1] { - case "cli": - cliMain(os.Args[2:]) - case "server": - server(os.Args[2:]) - default: - log.Println("Usage: guichet [server|cli] --help") - os.Exit(1) + case "cli": + cliMain(os.Args[2:]) + case "server": + server(os.Args[2:]) + default: + log.Println("Usage: guichet [server|cli] --help") + os.Exit(1) } } @@ -192,10 +192,9 @@ func logRequest(handler http.Handler) http.Handler { // Page handlers ---- - // --- Home Controller type HomePageData struct { - User *LoggedUser + User *LoggedUser BaseDN string } @@ -208,7 +207,7 @@ func handleHome(w http.ResponseWriter, r *http.Request) { } data := &HomePageData{ - User: user, + User: user, BaseDN: config.BaseDN, } @@ -235,7 +234,7 @@ func handleLogout(w http.ResponseWriter, r *http.Request) { http.Redirect(w, r, "/login", http.StatusFound) } -// --- Login Controller --- +// --- Login Controller --- type LoginFormData struct { Username string WrongUser bool @@ -254,7 +253,7 @@ func handleLogin(w http.ResponseWriter, r *http.Request) { username := strings.Join(r.Form["username"], "") password := strings.Join(r.Form["password"], "") - loginInfo := LoginInfo { username, password } + loginInfo := LoginInfo{username, password} l, err := NewLdapCon() if err != nil { |