Refactoring

This commit is contained in:
Chris Mann 2023-07-26 11:27:49 +02:00
parent 7c70657127
commit a7fd521f62
4 changed files with 28 additions and 27 deletions

View file

@ -34,8 +34,8 @@
<input type="text" id="surname" name="surname" class="form-control" value="{{ .Surname }}" />
</div>
<div class="form-group">
<label for="otheremail">Email de secours:</label>
<input type="text" id="otheremail" name="otheremail" class="form-control" value="{{ .OtherEmail }}" />
<label for="othermailbox">Email de secours:</label>
<input type="text" id="othermailbox" name="othermailbox" class="form-control" value="{{ .OtherMailbox }}" />
<small class="form-text text-muted">
Le courriel de l'utilisateur.
</small>

View file

@ -202,7 +202,7 @@ func handleNewAccount(w http.ResponseWriter, r *http.Request, l *ldap.Conn, invi
newUser.GivenName = strings.TrimSpace(strings.Join(r.Form["givenname"], ""))
newUser.SN = strings.TrimSpace(strings.Join(r.Form["surname"], ""))
newUser.Mail = strings.TrimSpace(strings.Join(r.Form["mail"], ""))
newUser.UID = strings.TrimSpace(strings.Join(r.Form["otheremail"], ""))
newUser.UID = strings.TrimSpace(strings.Join(r.Form["othermailbox"], ""))
newUser.CN = strings.TrimSpace(strings.Join(r.Form["username"], ""))
newUser.DN = "cn=" + strings.TrimSpace(strings.Join(r.Form["username"], "")) + "," + config.InvitationBaseDN

View file

@ -45,7 +45,7 @@ func handleUser(w http.ResponseWriter, r *http.Request) {
data.DisplayName = login.UserEntry.GetAttributeValue("displayName")
data.GivenName = login.UserEntry.GetAttributeValue("givenName")
data.Surname = login.UserEntry.GetAttributeValue("sn")
data.OtherEmail = login.UserEntry.GetAttributeValue("carLicense")
data.OtherMailbox = login.UserEntry.GetAttributeValue("carLicense")
// data.Visibility = login.UserEntry.GetAttributeValue(FIELD_NAME_DIRECTORY_VISIBILITY)
data.Description = login.UserEntry.GetAttributeValue("description")
//data.ProfilePicture = login.UserEntry.GetAttributeValue(FIELD_NAME_PROFILE_PICTURE)
@ -55,14 +55,15 @@ func handleUser(w http.ResponseWriter, r *http.Request) {
r.ParseMultipartForm(5 << 20)
user := User{
DN: login.Info.DN,
// CN: ,
GivenName: strings.TrimSpace(strings.Join(r.Form["given_name"], "")),
DisplayName: strings.TrimSpace(strings.Join(r.Form["display_name"], "")),
Mail: strings.TrimSpace(strings.Join(r.Form["mail"], "")),
SN: strings.TrimSpace(strings.Join(r.Form["surname"], "")),
//UID: ,
OtherMailbox: strings.TrimSpace(strings.Join(r.Form["othermailbox"], "")),
Description: strings.TrimSpace(strings.Join(r.Form["description"], "")),
// Password: ,
//UID: ,
// CN: ,
}
if user.DisplayName != "" {

View file

@ -156,7 +156,7 @@ type NewAccountData struct {
Surname string
Mail string
SuggestPW string
OtherEmail string
OtherMailbox string
ErrorUsernameTaken bool
ErrorInvalidUsername bool
@ -187,7 +187,7 @@ type ProfileTplData struct {
GivenName string
Surname string
Description string
OtherEmail string
OtherMailbox string
Common NestedCommonTplData
Login NestedLoginTplData
}