aboutsummaryrefslogtreecommitdiff
path: root/invite.go
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-12-01 23:05:59 +0100
committerAlex Auvolat <alex@adnab.me>2022-12-01 23:25:26 +0100
commit5eed8fa506bbd24469ec4d42a183928be89a325b (patch)
tree3ed0e5f514ec1c628bd6c0bbe634d12f5cb8ada4 /invite.go
parent3c846b6a59c1e725b56b7784c30cfbd5a3dc080b (diff)
downloadguichet-5eed8fa506bbd24469ec4d42a183928be89a325b.tar.gz
guichet-5eed8fa506bbd24469ec4d42a183928be89a325b.zip
Make repo into a Nix flake
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..ea356bb 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 := getTemplate("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 := getTemplate("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 := getTemplate("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(templatePath + "/invite_mail.txt"))
buf := bytes.NewBuffer([]byte{})
templateMail.Execute(buf, &CodeMailFields{
To: sendto,