diff --git a/admin.go b/admin.go index 60296dc..5a86fe2 100644 --- a/admin.go +++ b/admin.go @@ -1,9 +1,9 @@ package main import ( + "fmt" "html/template" "net/http" - "fmt" "sort" "github.com/go-ldap/ldap/v3" @@ -31,9 +31,9 @@ func checkAdminLogin(w http.ResponseWriter, r *http.Request) *LoginStatus { } type AdminUsersTplData struct { - Login *LoginStatus + Login *LoginStatus UserNameAttr string - Users []*ldap.Entry + Users []*ldap.Entry } func handleAdminUsers(w http.ResponseWriter, r *http.Request) { @@ -58,9 +58,9 @@ func handleAdminUsers(w http.ResponseWriter, r *http.Request) { } data := &AdminUsersTplData{ - Login: login, + Login: login, UserNameAttr: config.UserNameAttr, - Users: sr.Entries, + Users: sr.Entries, } sort.Sort(data) diff --git a/profile.go b/profile.go index 00e93dd..fa372bc 100644 --- a/profile.go +++ b/profile.go @@ -63,10 +63,11 @@ func handleProfile(w http.ResponseWriter, r *http.Request) { } type PasswdTplData struct { - Status *LoginStatus - ErrorMessage string - NoMatchError bool - Success bool + Status *LoginStatus + ErrorMessage string + TooShortError bool + NoMatchError bool + Success bool } func handlePasswd(w http.ResponseWriter, r *http.Request) { @@ -89,7 +90,9 @@ func handlePasswd(w http.ResponseWriter, r *http.Request) { password := strings.Join(r.Form["password"], "") password2 := strings.Join(r.Form["password2"], "") - if password2 != password { + if len(password) < 8 { + data.TooShortError = true + } else if password2 != password { data.NoMatchError = true } else { modify_request := ldap.NewModifyRequest(login.Info.DN, nil) diff --git a/templates/admin_users.html b/templates/admin_users.html index 8ca80e2..39e291c 100644 --- a/templates/admin_users.html +++ b/templates/admin_users.html @@ -1,7 +1,9 @@ {{define "title"}}Liste des utilisateurs |{{end}} {{define "body"}} +