Ajout d'un lien de contact/support dans la page de profil
Adresse de contact et sujet par défaut configurable dans le fichier de configuration
This commit is contained in:
parent
898301bf65
commit
e62837d7be
|
@ -9,6 +9,7 @@ import (
|
|||
type Config struct {
|
||||
HTTP HTTPConfig
|
||||
LDAP LDAPConfig
|
||||
Contact ContactConfig
|
||||
}
|
||||
|
||||
type HTTPConfig struct {
|
||||
|
@ -23,6 +24,11 @@ type LDAPConfig struct {
|
|||
UserSearchFilterPattern string
|
||||
}
|
||||
|
||||
type ContactConfig struct {
|
||||
Email string
|
||||
Subject string
|
||||
}
|
||||
|
||||
// NewFromFile retrieves the configuration from the given file
|
||||
func NewFromFile(filepath string) (*Config, error) {
|
||||
config := NewDefault()
|
||||
|
@ -48,6 +54,10 @@ func NewDefault() *Config {
|
|||
BaseDN: "o=org,c=fr",
|
||||
UserSearchFilterPattern: "(&(objectClass=person)(uid=%s))",
|
||||
},
|
||||
Contact: ContactConfig{
|
||||
Email: "contact@cadoles-profile.local",
|
||||
Subject: "[Cadoles Profile] Help needed",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -196,10 +196,12 @@ func serveProfilePage(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
tmpl := template.Must(ctn)
|
||||
config := config.Must(ctn)
|
||||
|
||||
data := extendTemplateData(w, r, template.Data{
|
||||
"EntryAttributes": results.Entries[0].Attributes,
|
||||
csrf.TemplateTag: csrf.TemplateField(r),
|
||||
"Contact": config.Contact,
|
||||
})
|
||||
|
||||
if err := tmpl.RenderPage(w, "profile.html.tmpl", data); err != nil {
|
||||
|
|
|
@ -49,6 +49,9 @@
|
|||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<p class="has-margin-top-small has-text-centered">
|
||||
<strong>Une question, un problème ?</strong> <a href="mailto:{{ .Contact.Email }}?subject={{ .Contact.Subject }}">Contacter le support</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue