Refactoring
This commit is contained in:
parent
a7fd521f62
commit
cb57eeea47
5 changed files with 12 additions and 0 deletions
|
@ -147,6 +147,7 @@ func modify(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
|
|||
replaceIfContent(modify_request, "displayName", user.DisplayName, previousUser.DisplayName)
|
||||
replaceIfContent(modify_request, "givenName", user.GivenName, previousUser.GivenName)
|
||||
replaceIfContent(modify_request, "sn", user.SN, previousUser.SN)
|
||||
replaceIfContent(modify_request, "carLicense", user.OtherMailbox, user.OtherMailbox)
|
||||
replaceIfContent(modify_request, "description", user.Description, previousUser.Description)
|
||||
err = ldapConn.Modify(modify_request)
|
||||
if err != nil {
|
||||
|
|
|
@ -58,6 +58,11 @@
|
|||
<input type="text" id="mail" name="mail" class="form-control" value="{{ .Mail }}" />
|
||||
</div>
|
||||
<input type="hidden" name="mail" value="" />
|
||||
<div class="form-group">
|
||||
<label for="othermailbox">Email de secours:</label>
|
||||
<input type="text" id="othermailbox" name="othermailbox" class="form-control" value="{{ .OtherMailbox }}" />
|
||||
</div>
|
||||
<input type="hidden" name="mail" value="" />
|
||||
<div class="form-group">
|
||||
<label for="givenname">Prénom :</label>
|
||||
<input type="text" id="givenname" name="givenname" class="form-control" value="{{ .GivenName }}" />
|
||||
|
|
|
@ -937,6 +937,7 @@ func handleAdminCreate(w http.ResponseWriter, r *http.Request) {
|
|||
data.Member = strings.TrimSpace(strings.Join(r.Form["member"], ""))
|
||||
data.Description = strings.TrimSpace(strings.Join(r.Form["description"], ""))
|
||||
data.SN = strings.TrimSpace(strings.Join(r.Form["sn"], ""))
|
||||
data.OtherMailbox = strings.TrimSpace(strings.Join(r.Form["othermailbox"], ""))
|
||||
|
||||
object_class := []string{}
|
||||
for _, oc := range strings.Split(data.ObjectClass, "\n") {
|
||||
|
@ -993,6 +994,9 @@ func handleAdminCreate(w http.ResponseWriter, r *http.Request) {
|
|||
newUser.SN = data.SN
|
||||
// req.Attribute("sn", []string{data.SN})
|
||||
}
|
||||
if data.OtherMailbox != "" {
|
||||
newUser.OtherMailbox = data.OtherMailbox
|
||||
}
|
||||
if data.Description != "" {
|
||||
newUser.Description = data.Description
|
||||
// req.Attribute("description", []string{data.Description})
|
||||
|
|
|
@ -201,6 +201,7 @@ func handleNewAccount(w http.ResponseWriter, r *http.Request, l *ldap.Conn, invi
|
|||
newUser.DisplayName = strings.TrimSpace(strings.Join(r.Form["displayname"], ""))
|
||||
newUser.GivenName = strings.TrimSpace(strings.Join(r.Form["givenname"], ""))
|
||||
newUser.SN = strings.TrimSpace(strings.Join(r.Form["surname"], ""))
|
||||
newUser.OtherMailbox = strings.TrimSpace(strings.Join(r.Form["othermailbox"], ""))
|
||||
newUser.Mail = strings.TrimSpace(strings.Join(r.Form["mail"], ""))
|
||||
newUser.UID = strings.TrimSpace(strings.Join(r.Form["othermailbox"], ""))
|
||||
newUser.CN = strings.TrimSpace(strings.Join(r.Form["username"], ""))
|
||||
|
|
1
view.go
1
view.go
|
@ -113,6 +113,7 @@ type CreateData struct {
|
|||
StructuralObjectClass string
|
||||
ObjectClass string
|
||||
SN string
|
||||
OtherMailbox string
|
||||
|
||||
Common NestedCommonTplData
|
||||
Login NestedLoginTplData
|
||||
|
|
Loading…
Reference in a new issue