Handle multiple mail values

This commit is contained in:
Chris Mann 2023-07-27 21:34:58 +02:00
parent 641e080789
commit b60040113c
3 changed files with 63 additions and 49 deletions

View file

@ -26,14 +26,25 @@
</div>
<div class="form-group col-md-6">
<label for="mail">Adresse e-mail:</label>
<input type="text" id="mail" disabled="true" name="mail" class="form-control" value="{{ .Mail }}" />
<input type="text" id="mail" disabled="true" name="mail" class="form-control" value="{{ .Data.Mail }}" />
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
{{range $index, $email := .Data.MailValues }}
<input type="email" name="email" value="{{$email}}" required>
<input type="submit" name="delete" value="Delete">
<input type="hidden" name="index" value="{{$index}}">
<br>
{{end}}
<input type="email" name="email" required>
<input type="submit" name="add" value="Add">
</div>
</div>
<div class="form-group">
<label for="display_name">Nom complet:</label>
<input type="text" id="display_name" name="display_name" class="form-control" value="{{ .DisplayName }}" />
<input type="text" id="display_name" name="display_name" class="form-control" value="{{ .Data.DisplayName }}" />
</div>
{{/*
<!--
<h4>Informations complémentaires</h4>
@ -68,17 +79,17 @@
<div class="form-row">
<div class="form-group col-md-6">
<label for="given_name">Prénom:</label>
<input type="text" id="given_name" name="given_name" class="form-control" value="{{ .GivenName }}" />
<input type="text" id="given_name" name="given_name" class="form-control" value="{{ .Data.GivenName }}" />
</div>
<div class="form-group col-md-6">
<label for="surname">Nom de famille:</label>
<input type="text" id="surname" name="surname" class="form-control" value="{{ .Surname }}" />
<input type="text" id="surname" name="surname" class="form-control" value="{{ .Data.Surname }}" />
</div>
</div>
<div class="form-group">
<label for="description">Description</label>
<textarea id="description" name="description" class="form-control">{{ .Description }}</textarea>
<textarea id="description" name="description" class="form-control">{{ .Data.Description }}</textarea>
</div>
<button type="submit" class="btn btn-primary">Enregistrer les modifications</button>
</form>

View file

@ -10,8 +10,8 @@ import (
)
func handleUserWait(w http.ResponseWriter, r *http.Request) {
templateProfile := getTemplate("user/wait.html")
templateProfile.Execute(w, HomePageData{
templateUser := getTemplate("user/wait.html")
templateUser.Execute(w, HomePageData{
Common: NestedCommonTplData{
CanAdmin: false,
LoggedIn: false,
@ -20,7 +20,7 @@ func handleUserWait(w http.ResponseWriter, r *http.Request) {
}
func handleUser(w http.ResponseWriter, r *http.Request) {
templateProfile := getTemplate("user.html")
templateUser := getTemplate("user.html")
login := checkLogin(w, r)
if login == nil {
@ -46,6 +46,7 @@ func handleUser(w http.ResponseWriter, r *http.Request) {
data.GivenName = login.UserEntry.GetAttributeValue("givenName")
data.Surname = login.UserEntry.GetAttributeValue("sn")
data.OtherMailbox = login.UserEntry.GetAttributeValue("carLicense")
data.MailValues = login.UserEntry.GetAttributeValues("mail")
// data.Visibility = login.UserEntry.GetAttributeValue(FIELD_NAME_DIRECTORY_VISIBILITY)
data.Description = login.UserEntry.GetAttributeValue("description")
//data.ProfilePicture = login.UserEntry.GetAttributeValue(FIELD_NAME_PROFILE_PICTURE)
@ -122,5 +123,6 @@ func handleUser(w http.ResponseWriter, r *http.Request) {
}
templateProfile.Execute(w, data)
// templateUser.Execute(w, data)
execTemplate(w, templateUser, data.Common, data.Login, *config, data)
}

View file

@ -190,6 +190,7 @@ type CodeMailFields struct {
}
type ProfileTplData struct {
Mail string
MailValues []string
DisplayName string
GivenName string
Surname string