Handle multiple mail values
This commit is contained in:
parent
641e080789
commit
b60040113c
3 changed files with 63 additions and 49 deletions
|
@ -8,34 +8,45 @@
|
||||||
<h2>Modifier mon profil</h2>
|
<h2>Modifier mon profil</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{if .Common.ErrorMessage}}
|
{{if .Common.ErrorMessage}}
|
||||||
<div class="alert alert-danger mt-4">Impossible d'effectuer la modification.
|
<div class="alert alert-danger mt-4">Impossible d'effectuer la modification.
|
||||||
<div style="font-size: 0.8em">{{ .Common.ErrorMessage }}</div>
|
<div style="font-size: 0.8em">{{ .Common.ErrorMessage }}</div>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
{{if .Common.Success}}
|
||||||
|
<div class="alert alert-success mt-4">
|
||||||
|
Profil enregistré.
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
<form method="POST" class="mt-4" enctype="multipart/form-data">
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label>Identifiant:</label>
|
||||||
|
<input type="text" disabled="true" class="form-control" value="{{ .Login.Status.Info.Username }}" />
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
<div class="form-group col-md-6">
|
||||||
{{if .Common.Success}}
|
<label for="mail">Adresse e-mail:</label>
|
||||||
<div class="alert alert-success mt-4">
|
<input type="text" id="mail" disabled="true" name="mail" class="form-control" value="{{ .Data.Mail }}" />
|
||||||
Profil enregistré.
|
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
</div>
|
||||||
<form method="POST" class="mt-4" enctype="multipart/form-data">
|
<div class="form-row">
|
||||||
<div class="form-row">
|
<div class="form-group col-md-6">
|
||||||
<div class="form-group col-md-6">
|
{{range $index, $email := .Data.MailValues }}
|
||||||
<label>Identifiant:</label>
|
<input type="email" name="email" value="{{$email}}" required>
|
||||||
<input type="text" disabled="true" class="form-control" value="{{ .Login.Status.Info.Username }}" />
|
<input type="submit" name="delete" value="Delete">
|
||||||
</div>
|
<input type="hidden" name="index" value="{{$index}}">
|
||||||
<div class="form-group col-md-6">
|
<br>
|
||||||
<label for="mail">Adresse e-mail:</label>
|
{{end}}
|
||||||
<input type="text" id="mail" disabled="true" name="mail" class="form-control" value="{{ .Mail }}" />
|
<input type="email" name="email" required>
|
||||||
</div>
|
<input type="submit" name="add" value="Add">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
</div>
|
||||||
<label for="display_name">Nom complet:</label>
|
<div class="form-group">
|
||||||
<input type="text" id="display_name" name="display_name" class="form-control" value="{{ .DisplayName }}" />
|
<label for="display_name">Nom complet:</label>
|
||||||
</div>
|
<input type="text" id="display_name" name="display_name" class="form-control" value="{{ .Data.DisplayName }}" />
|
||||||
|
</div>
|
||||||
{{/*
|
{{/*
|
||||||
<!--
|
<!--
|
||||||
<h4>Informations complémentaires</h4>
|
<h4>Informations complémentaires</h4>
|
||||||
{{if .ProfilePicture}}
|
{{if .ProfilePicture}}
|
||||||
<div class="float-right">
|
<div class="float-right">
|
||||||
|
@ -45,7 +56,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
-->
|
-->
|
||||||
<!--
|
<!--
|
||||||
<div class="form-group form-check">
|
<div class="form-group form-check">
|
||||||
{{if .Visibility}}
|
{{if .Visibility}}
|
||||||
<input class="form-check-input" name="visibility" type="checkbox" id="visibility" value="on" checked>
|
<input class="form-check-input" name="visibility" type="checkbox" id="visibility" value="on" checked>
|
||||||
|
@ -55,7 +66,7 @@
|
||||||
<label class="form-check-label" for="visibility">Apparaître sur l'annuaire</label>
|
<label class="form-check-label" for="visibility">Apparaître sur l'annuaire</label>
|
||||||
</div>
|
</div>
|
||||||
-->
|
-->
|
||||||
<!--
|
<!--
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-8 input-group mb-3 custom-file">
|
<div class="form-group col-md-8 input-group mb-3 custom-file">
|
||||||
<label for="image">Photo de profil:</label>
|
<label for="image">Photo de profil:</label>
|
||||||
|
@ -64,23 +75,23 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
-->
|
-->
|
||||||
*/}}
|
*/}}
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="given_name">Prénom:</label>
|
<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 }}" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</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="{{ .Data.Surname }}" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="description">Description</label>
|
<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>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary">Enregistrer les modifications</button>
|
<button type="submit" class="btn btn-primary">Enregistrer les modifications</button>
|
||||||
</form>
|
</form>
|
||||||
<script src="/static/javascript/minio.js"></script>
|
<script src="/static/javascript/minio.js"></script>
|
||||||
{{end}}
|
{{end}}
|
10
view-user.go
10
view-user.go
|
@ -10,8 +10,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func handleUserWait(w http.ResponseWriter, r *http.Request) {
|
func handleUserWait(w http.ResponseWriter, r *http.Request) {
|
||||||
templateProfile := getTemplate("user/wait.html")
|
templateUser := getTemplate("user/wait.html")
|
||||||
templateProfile.Execute(w, HomePageData{
|
templateUser.Execute(w, HomePageData{
|
||||||
Common: NestedCommonTplData{
|
Common: NestedCommonTplData{
|
||||||
CanAdmin: false,
|
CanAdmin: false,
|
||||||
LoggedIn: false,
|
LoggedIn: false,
|
||||||
|
@ -20,7 +20,7 @@ func handleUserWait(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleUser(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)
|
login := checkLogin(w, r)
|
||||||
if login == nil {
|
if login == nil {
|
||||||
|
@ -46,6 +46,7 @@ func handleUser(w http.ResponseWriter, r *http.Request) {
|
||||||
data.GivenName = login.UserEntry.GetAttributeValue("givenName")
|
data.GivenName = login.UserEntry.GetAttributeValue("givenName")
|
||||||
data.Surname = login.UserEntry.GetAttributeValue("sn")
|
data.Surname = login.UserEntry.GetAttributeValue("sn")
|
||||||
data.OtherMailbox = login.UserEntry.GetAttributeValue("carLicense")
|
data.OtherMailbox = login.UserEntry.GetAttributeValue("carLicense")
|
||||||
|
data.MailValues = login.UserEntry.GetAttributeValues("mail")
|
||||||
// data.Visibility = login.UserEntry.GetAttributeValue(FIELD_NAME_DIRECTORY_VISIBILITY)
|
// data.Visibility = login.UserEntry.GetAttributeValue(FIELD_NAME_DIRECTORY_VISIBILITY)
|
||||||
data.Description = login.UserEntry.GetAttributeValue("description")
|
data.Description = login.UserEntry.GetAttributeValue("description")
|
||||||
//data.ProfilePicture = login.UserEntry.GetAttributeValue(FIELD_NAME_PROFILE_PICTURE)
|
//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)
|
||||||
}
|
}
|
||||||
|
|
1
view.go
1
view.go
|
@ -190,6 +190,7 @@ type CodeMailFields struct {
|
||||||
}
|
}
|
||||||
type ProfileTplData struct {
|
type ProfileTplData struct {
|
||||||
Mail string
|
Mail string
|
||||||
|
MailValues []string
|
||||||
DisplayName string
|
DisplayName string
|
||||||
GivenName string
|
GivenName string
|
||||||
Surname string
|
Surname string
|
||||||
|
|
Loading…
Reference in a new issue