Disable email modification in user profile

This commit is contained in:
Alex Auvolat 2020-02-11 23:24:53 +01:00
parent 86bf6a131d
commit 7ca56ba8df
3 changed files with 7 additions and 9 deletions

View File

@ -12,7 +12,7 @@ job "guichet" {
task "server" { task "server" {
driver = "docker" driver = "docker"
config { config {
image = "lxpz/guichet_amd64:2" image = "lxpz/guichet_amd64:3"
readonly_rootfs = true readonly_rootfs = true
port_map { port_map {
web_port = 9991 web_port = 9991

View File

@ -32,16 +32,19 @@ func handleProfile(w http.ResponseWriter, r *http.Request) {
Success: false, 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" { if r.Method == "POST" {
r.ParseForm() r.ParseForm()
data.Mail = strings.TrimSpace(strings.Join(r.Form["mail"], ""))
data.DisplayName = strings.TrimSpace(strings.Join(r.Form["display_name"], "")) data.DisplayName = strings.TrimSpace(strings.Join(r.Form["display_name"], ""))
data.GivenName = strings.TrimSpace(strings.Join(r.Form["given_name"], "")) data.GivenName = strings.TrimSpace(strings.Join(r.Form["given_name"], ""))
data.Surname = strings.TrimSpace(strings.Join(r.Form["surname"], "")) data.Surname = strings.TrimSpace(strings.Join(r.Form["surname"], ""))
modify_request := ldap.NewModifyRequest(login.Info.DN, nil) 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("displayname", []string{data.DisplayName})
modify_request.Replace("givenname", []string{data.GivenName}) modify_request.Replace("givenname", []string{data.GivenName})
modify_request.Replace("sn", []string{data.Surname}) modify_request.Replace("sn", []string{data.Surname})
@ -52,11 +55,6 @@ func handleProfile(w http.ResponseWriter, r *http.Request) {
} else { } else {
data.Success = true 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) templateProfile.Execute(w, data)

View File

@ -23,7 +23,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="mail">Adresse e-mail:</label> <label for="mail">Adresse e-mail:</label>
<input type="text" id="mail" name="mail" class="form-control" value="{{ .Mail }}" /> <input type="text" id="mail" disabled="true" name="mail" class="form-control" value="{{ .Mail }}" />
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="display_name">Nom complet:</label> <label for="display_name">Nom complet:</label>