Refactoring
This commit is contained in:
parent
7c70657127
commit
a7fd521f62
4 changed files with 28 additions and 27 deletions
|
@ -34,8 +34,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="otheremail">Email de secours:</label>
|
<label for="othermailbox">Email de secours:</label>
|
||||||
<input type="text" id="otheremail" name="otheremail" class="form-control" value="{{ .OtherEmail }}" />
|
<input type="text" id="othermailbox" name="othermailbox" class="form-control" value="{{ .OtherMailbox }}" />
|
||||||
<small class="form-text text-muted">
|
<small class="form-text text-muted">
|
||||||
Le courriel de l'utilisateur.
|
Le courriel de l'utilisateur.
|
||||||
</small>
|
</small>
|
||||||
|
|
|
@ -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.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.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["otheremail"], ""))
|
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.InvitationBaseDN
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ func handleUser(w http.ResponseWriter, r *http.Request) {
|
||||||
data.DisplayName = login.UserEntry.GetAttributeValue("displayName")
|
data.DisplayName = login.UserEntry.GetAttributeValue("displayName")
|
||||||
data.GivenName = login.UserEntry.GetAttributeValue("givenName")
|
data.GivenName = login.UserEntry.GetAttributeValue("givenName")
|
||||||
data.Surname = login.UserEntry.GetAttributeValue("sn")
|
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.Visibility = login.UserEntry.GetAttributeValue(FIELD_NAME_DIRECTORY_VISIBILITY)
|
||||||
data.Description = login.UserEntry.GetAttributeValue("description")
|
data.Description = login.UserEntry.GetAttributeValue("description")
|
||||||
//data.ProfilePicture = login.UserEntry.GetAttributeValue(FIELD_NAME_PROFILE_PICTURE)
|
//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)
|
r.ParseMultipartForm(5 << 20)
|
||||||
user := User{
|
user := User{
|
||||||
DN: login.Info.DN,
|
DN: login.Info.DN,
|
||||||
// CN: ,
|
|
||||||
GivenName: strings.TrimSpace(strings.Join(r.Form["given_name"], "")),
|
GivenName: strings.TrimSpace(strings.Join(r.Form["given_name"], "")),
|
||||||
DisplayName: strings.TrimSpace(strings.Join(r.Form["display_name"], "")),
|
DisplayName: strings.TrimSpace(strings.Join(r.Form["display_name"], "")),
|
||||||
Mail: strings.TrimSpace(strings.Join(r.Form["mail"], "")),
|
Mail: strings.TrimSpace(strings.Join(r.Form["mail"], "")),
|
||||||
SN: strings.TrimSpace(strings.Join(r.Form["surname"], "")),
|
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"], "")),
|
Description: strings.TrimSpace(strings.Join(r.Form["description"], "")),
|
||||||
// Password: ,
|
// Password: ,
|
||||||
|
//UID: ,
|
||||||
|
// CN: ,
|
||||||
}
|
}
|
||||||
|
|
||||||
if user.DisplayName != "" {
|
if user.DisplayName != "" {
|
||||||
|
|
4
view.go
4
view.go
|
@ -156,7 +156,7 @@ type NewAccountData struct {
|
||||||
Surname string
|
Surname string
|
||||||
Mail string
|
Mail string
|
||||||
SuggestPW string
|
SuggestPW string
|
||||||
OtherEmail string
|
OtherMailbox string
|
||||||
|
|
||||||
ErrorUsernameTaken bool
|
ErrorUsernameTaken bool
|
||||||
ErrorInvalidUsername bool
|
ErrorInvalidUsername bool
|
||||||
|
@ -187,7 +187,7 @@ type ProfileTplData struct {
|
||||||
GivenName string
|
GivenName string
|
||||||
Surname string
|
Surname string
|
||||||
Description string
|
Description string
|
||||||
OtherEmail string
|
OtherMailbox string
|
||||||
Common NestedCommonTplData
|
Common NestedCommonTplData
|
||||||
Login NestedLoginTplData
|
Login NestedLoginTplData
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue