aboutsummaryrefslogtreecommitdiff
path: root/invite.go
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2022-07-19 15:39:49 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2022-07-19 15:39:49 +0200
commita84ac778adf57d6446eef6577e617a80d4c6bb8e (patch)
tree5c622349b2784cbe7c3fd7fa901758c2b161b091 /invite.go
parentb41630e941b44a8fffe09f42d9a7efb728fcbfa1 (diff)
downloadguichet-a84ac778adf57d6446eef6577e617a80d4c6bb8e.tar.gz
guichet-a84ac778adf57d6446eef6577e617a80d4c6bb8e.zip
Ease packaging by making resource path configurable
Diffstat (limited to 'invite.go')
-rw-r--r--invite.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/invite.go b/invite.go
index 689c7e4..2d01e44 100644
--- a/invite.go
+++ b/invite.go
@@ -60,7 +60,7 @@ func handleInvitationCode(w http.ResponseWriter, r *http.Request) {
inviteDn := config.InvitationNameAttr + "=" + code_id + "," + config.InvitationBaseDN
err := l.Bind(inviteDn, code_pw)
if err != nil {
- templateInviteInvalidCode := template.Must(template.ParseFiles("templates/layout.html", "templates/invite_invalid_code.html"))
+ templateInviteInvalidCode := template.Must(template.ParseFiles(config.Resources[0]+"/templates/layout.html", config.Resources[0]+"/templates/invite_invalid_code.html"))
templateInviteInvalidCode.Execute(w, nil)
return
}
@@ -110,7 +110,7 @@ type NewAccountData struct {
}
func handleNewAccount(w http.ResponseWriter, r *http.Request, l *ldap.Conn, invitedBy string) bool {
- templateInviteNewAccount := template.Must(template.ParseFiles("templates/layout.html", "templates/invite_new_account.html"))
+ templateInviteNewAccount := template.Must(template.ParseFiles(config.Resources[0]+"/templates/layout.html", config.Resources[0]+"/templates/invite_new_account.html"))
data := &NewAccountData{}
@@ -239,7 +239,7 @@ type CodeMailFields struct {
}
func handleInviteSendCode(w http.ResponseWriter, r *http.Request) {
- templateInviteSendCode := template.Must(template.ParseFiles("templates/layout.html", "templates/invite_send_code.html"))
+ templateInviteSendCode := template.Must(template.ParseFiles(config.Resources[0]+"/templates/layout.html", config.Resources[0]+"/templates/invite_send_code.html"))
login := checkInviterLogin(w, r)
if login == nil {
@@ -298,7 +298,7 @@ func trySendCode(login *LoginStatus, choice string, sendto string, data *SendCod
return
}
- templateMail := template.Must(template.ParseFiles("templates/invite_mail.txt"))
+ templateMail := template.Must(template.ParseFiles(config.Resources[0]+"/templates/invite_mail.txt"))
buf := bytes.NewBuffer([]byte{})
templateMail.Execute(buf, &CodeMailFields{
To: sendto,