diff options
author | Alex Auvolat <alex@adnab.me> | 2020-02-11 23:24:53 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2020-02-11 23:24:53 +0100 |
commit | 7ca56ba8df6c936909e3fe64d8e22d6ece50e9b2 (patch) | |
tree | 79dab4f7176bb83943c466a2eabd1775a2c29b4f /profile.go | |
parent | 86bf6a131d4681195921bf35b4710c76f11820b1 (diff) | |
download | guichet-7ca56ba8df6c936909e3fe64d8e22d6ece50e9b2.tar.gz guichet-7ca56ba8df6c936909e3fe64d8e22d6ece50e9b2.zip |
Disable email modification in user profile
Diffstat (limited to 'profile.go')
-rw-r--r-- | profile.go | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -32,16 +32,19 @@ func handleProfile(w http.ResponseWriter, r *http.Request) { Success: false, } + data.Mail = login.UserEntry.GetAttributeValue("mail") + data.DisplayName = login.UserEntry.GetAttributeValue("displayname") + data.GivenName = login.UserEntry.GetAttributeValue("givenname") + data.Surname = login.UserEntry.GetAttributeValue("sn") + if r.Method == "POST" { r.ParseForm() - data.Mail = strings.TrimSpace(strings.Join(r.Form["mail"], "")) data.DisplayName = strings.TrimSpace(strings.Join(r.Form["display_name"], "")) data.GivenName = strings.TrimSpace(strings.Join(r.Form["given_name"], "")) data.Surname = strings.TrimSpace(strings.Join(r.Form["surname"], "")) modify_request := ldap.NewModifyRequest(login.Info.DN, nil) - modify_request.Replace("mail", []string{data.Mail}) modify_request.Replace("displayname", []string{data.DisplayName}) modify_request.Replace("givenname", []string{data.GivenName}) modify_request.Replace("sn", []string{data.Surname}) @@ -52,11 +55,6 @@ func handleProfile(w http.ResponseWriter, r *http.Request) { } else { data.Success = true } - } else { - data.Mail = login.UserEntry.GetAttributeValue("mail") - data.DisplayName = login.UserEntry.GetAttributeValue("displayname") - data.GivenName = login.UserEntry.GetAttributeValue("givenname") - data.Surname = login.UserEntry.GetAttributeValue("sn") } templateProfile.Execute(w, data) |