Factoring the model user and correcting password

This commit is contained in:
Chris Mann 2023-07-22 13:20:40 +02:00
parent ed810f7f02
commit 5ca2555b76
2 changed files with 6 additions and 6 deletions

View file

@ -151,13 +151,13 @@ func handleNewAccount(w http.ResponseWriter, r *http.Request, l *ldap.Conn, invi
newUser := User{} newUser := User{}
// login := checkLogin(w, r) // login := checkLogin(w, r)
newUser.CN = fmt.Sprintf("%s@%s", strings.TrimSpace(strings.Join(r.Form["username"], "")), "lesgv.com") // newUser.Mail = fmt.Sprintf("%s@%s", strings.TrimSpace(strings.Join(r.Form["username"], "")), "lesgv.com")
newUser.DisplayName = strings.TrimSpace(strings.Join(r.Form["displayname"], "")) newUser.DisplayName = strings.TrimSpace(strings.Join(r.Form["displayname"], ""))
newUser.GivenName = strings.TrimSpace(strings.Join(r.Form["givenname"], "")) newUser.GivenName = strings.TrimSpace(strings.Join(r.Form["givenname"], ""))
newUser.SN = strings.TrimSpace(strings.Join(r.Form["surname"], "")) newUser.SN = strings.TrimSpace(strings.Join(r.Form["surname"], ""))
newUser.UID = strings.TrimSpace(strings.Join(r.Form["username"], ""))
newUser.OtherMailbox = strings.TrimSpace(strings.Join(r.Form["otherMailbox"], ""))
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["username"], ""))
newUser.CN = strings.TrimSpace(strings.Join(r.Form["otherMailbox"], ""))
newUser.DN = "cn=" + newUser.CN + "," + config.InvitationBaseDN newUser.DN = "cn=" + newUser.CN + "," + config.InvitationBaseDN
password1 := strings.Join(r.Form["password"], "") password1 := strings.Join(r.Form["password"], "")

View file

@ -31,8 +31,8 @@
<input type="text" id="surname" name="surname" class="form-control" value="{{ .Surname }}" /> <input type="text" id="surname" name="surname" class="form-control" value="{{ .Surname }}" />
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="mail">Email de secours:</label> <label for="cn">Email de secours:</label>
<input type="text" id="othermailbox" name="othermailbox" class="form-control" value="{{ .OtherMailbox }}" /> <input type="text" id="cn" name="cn" class="form-control" value="{{ .CN }}" />
<small class="form-text text-muted"> <small class="form-text text-muted">
Le courriel de l'utilisateur. Le courriel de l'utilisateur.
</small> </small>
@ -42,7 +42,7 @@
<input type="text" id="displayname" name="displayname" class="form-control" value="{{ .DisplayName }}" /> <input type="text" id="displayname" name="displayname" class="form-control" value="{{ .DisplayName }}" />
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="username">Identifiant souhaité :</label> <label for="username">Identifiant :</label>
<input type="text" id="username" name="username" class="form-control" value="{{ .Username }}" /> <input type="text" id="username" name="username" class="form-control" value="{{ .Username }}" />
<small class="form-text text-muted"> <small class="form-text text-muted">
Votre identifiant doit être en minuscule. Votre identifiant doit être en minuscule.