Refactoring

This commit is contained in:
Chris Mann 2023-07-26 11:53:44 +02:00
parent 26344ac0b6
commit 3468d15fb3
3 changed files with 10 additions and 9 deletions

View file

@ -112,15 +112,16 @@ func add(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
log.Printf(fmt.Sprintf("add(User) ldapconn.Add: %v", user)) log.Printf(fmt.Sprintf("add(User) ldapconn.Add: %v", user))
//return err //return err
} }
passwordModifyRequest := ldap.NewPasswordModifyRequest(user.DN, "", user.Password) // passwordModifyRequest := ldap.NewPasswordModifyRequest(user.DN, "", user.Password)
_, err = ldapConn.PasswordModify(passwordModifyRequest) // _, err = ldapConn.PasswordModify(passwordModifyRequest)
if err != nil { // if err != nil {
return err // return err
} // }
// Send the email // Send the email
err = passwordLost(user, config, ldapConn) newUserLdapConn, _ := openNewUserLdap(config)
err = passwordLost(user, config, newUserLdapConn)
// sendMailTplData := SendMailTplData{ // sendMailTplData := SendMailTplData{
// From: "alice@resdigita.org", // From: "alice@resdigita.org",

View file

@ -85,10 +85,10 @@
Le mot de passe choisi est trop court (minimum 8 caractères). Le mot de passe choisi est trop court (minimum 8 caractères).
</div> </div>
{{end}} {{end}}
<div class="form-group"> <!-- <div class="form-group">
<label for="password2">Répéter le mot de passe :</label> <label for="password2">Répéter le mot de passe :</label>
<input type="password" id="password2" name="password2" class="form-control" /> <input type="password" id="password2" name="password2" class="form-control" />
</div> </div> -->
{{if .ErrorPasswordMismatch}} {{if .ErrorPasswordMismatch}}
<div class="alert alert-warning"> <div class="alert alert-warning">
Les deux mots de passe entrés ne correspondent pas. Les deux mots de passe entrés ne correspondent pas.

View file

@ -205,7 +205,7 @@ func handleNewAccount(w http.ResponseWriter, r *http.Request, l *ldap.Conn, invi
newUser.Mail = strings.TrimSpace(strings.Join(r.Form["mail"], "")) newUser.Mail = strings.TrimSpace(strings.Join(r.Form["mail"], ""))
newUser.UID = strings.TrimSpace(strings.Join(r.Form["othermailbox"], "")) newUser.UID = strings.TrimSpace(strings.Join(r.Form["othermailbox"], ""))
newUser.CN = strings.TrimSpace(strings.Join(r.Form["username"], "")) newUser.CN = strings.TrimSpace(strings.Join(r.Form["username"], ""))
newUser.DN = "cn=" + strings.TrimSpace(strings.Join(r.Form["username"], "")) + "," + config.InvitationBaseDN newUser.DN = "cn=" + strings.TrimSpace(strings.Join(r.Form["username"], "")) + "," + config.UserBaseDN
password1 := strings.Join(r.Form["password"], "") password1 := strings.Join(r.Form["password"], "")
password2 := strings.Join(r.Form["password2"], "") password2 := strings.Join(r.Form["password2"], "")