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 }}" />
|
||||
</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>
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
19
view-user.go
19
view-user.go
|
@ -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)
|
||||
|
@ -54,15 +54,16 @@ func handleUser(w http.ResponseWriter, r *http.Request) {
|
|||
//5MB maximum size files
|
||||
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: ,
|
||||
Description: strings.TrimSpace(strings.Join(r.Form["description"], "")),
|
||||
DN: login.Info.DN,
|
||||
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"], "")),
|
||||
OtherMailbox: strings.TrimSpace(strings.Join(r.Form["othermailbox"], "")),
|
||||
Description: strings.TrimSpace(strings.Join(r.Form["description"], "")),
|
||||
// Password: ,
|
||||
//UID: ,
|
||||
// CN: ,
|
||||
}
|
||||
|
||||
if user.DisplayName != "" {
|
||||
|
|
30
view.go
30
view.go
|
@ -150,13 +150,13 @@ type PasswordLostData struct {
|
|||
OtherMailbox string
|
||||
}
|
||||
type NewAccountData struct {
|
||||
Username string
|
||||
DisplayName string
|
||||
GivenName string
|
||||
Surname string
|
||||
Mail string
|
||||
SuggestPW string
|
||||
OtherEmail string
|
||||
Username string
|
||||
DisplayName string
|
||||
GivenName string
|
||||
Surname string
|
||||
Mail string
|
||||
SuggestPW string
|
||||
OtherMailbox string
|
||||
|
||||
ErrorUsernameTaken bool
|
||||
ErrorInvalidUsername bool
|
||||
|
@ -182,14 +182,14 @@ type CodeMailFields struct {
|
|||
Common NestedCommonTplData
|
||||
}
|
||||
type ProfileTplData struct {
|
||||
Mail string
|
||||
DisplayName string
|
||||
GivenName string
|
||||
Surname string
|
||||
Description string
|
||||
OtherEmail string
|
||||
Common NestedCommonTplData
|
||||
Login NestedLoginTplData
|
||||
Mail string
|
||||
DisplayName string
|
||||
GivenName string
|
||||
Surname string
|
||||
Description string
|
||||
OtherMailbox string
|
||||
Common NestedCommonTplData
|
||||
Login NestedLoginTplData
|
||||
}
|
||||
|
||||
//ProfilePicture string
|
||||
|
|
Loading…
Reference in a new issue