From ac6e32dd881c88ef082a7303508dab22e097b62d Mon Sep 17 00:00:00 2001 From: ajaydy Date: Mon, 22 Mar 2021 16:18:09 +0800 Subject: [PATCH] Feat - Sengkuni Reset Password & Temporary Password --- sengkuni-reset_password.go | 237 ++++++++++++++++++++++++++++++++ sengkuni-temporary_password.go | 239 +++++++++++++++++++++++++++++++++ 2 files changed, 476 insertions(+) create mode 100644 sengkuni-reset_password.go create mode 100644 sengkuni-temporary_password.go diff --git a/sengkuni-reset_password.go b/sengkuni-reset_password.go new file mode 100644 index 0000000..b39eb2c --- /dev/null +++ b/sengkuni-reset_password.go @@ -0,0 +1,237 @@ +package hermes + +// Flat is a theme +type SengkuniResetPassword struct{} + +// Name returns the name of the flat theme +func (dt *SengkuniResetPassword) Name() string { + return "sengkuni_reset_password" +} + +// HTMLTemplate returns a Golang template that will generate an HTML email. +func (dt *SengkuniResetPassword) HTMLTemplate() string { + return ` + + + + + + + Document + + + + +
+
+ + +

Hello {{ .Email.Body.Registration.Name }},

+ {{ range $row := .Email.Body.Registration.Intros }} +

{{ $row }}

+ {{ end }} +
+ {{ .Email.Body.Registration.ActionButton }} +

{{ .Email.Body.Registration.Help }}

+ {{ .Email.Body.Registration.ActionURL }} +

(The confirmation link is valid until {{ .Email.Body.Registration.Expiration }})

+
+

Best Regards,

+

{{ .Email.Body.Registration.Signature }}

+
+
+ + +
+ + + +` +} + +// PlainTextTemplate returns a Golang template that will generate an plain text email. +func (dt *SengkuniResetPassword) PlainTextTemplate() string { + return `

{{if .Email.Body.Title }}{{ .Email.Body.Title }}{{ else }}{{ .Email.Body.Greeting }} {{ .Email.Body.Name }}{{ end }},

+{{ with .Email.Body.Intros }} + {{ range $line := . }} +

{{ $line }}

+ {{ end }} +{{ end }} +{{ if (ne .Email.Body.FreeMarkdown "") }} + {{ .Email.Body.FreeMarkdown.ToHTML }} +{{ else }} + {{ with .Email.Body.Dictionary }} + + {{ end }} + {{ with .Email.Body.Table }} + {{ $data := .Data }} + {{ $columns := .Columns }} + {{ if gt (len $data) 0 }} + + + {{ $col := index $data 0 }} + {{ range $entry := $col }} + + {{ end }} + + {{ range $row := $data }} + + {{ range $cell := $row }} + + {{ end }} + + {{ end }} +
{{ $entry.Key }}
+ {{ $cell.Value }} +
+ {{ end }} + {{ end }} + {{ with .Email.Body.Actions }} + {{ range $action := . }} +

+ {{ $action.Instructions }} + {{ if $action.InviteCode }} + {{ $action.InviteCode }} + {{ end }} + {{ if $action.Button.Link }} + {{ $action.Button.Link }} + {{ end }} +

+ {{ end }} + {{ end }} +{{ end }} +{{ with .Email.Body.Outros }} + {{ range $line := . }} +

{{ $line }}

+ {{ end }} +{{ end }} +

{{.Email.Body.Signature}},
{{.Hermes.Product.Name}} - {{.Hermes.Product.Link}}

+ +

{{.Hermes.Product.Copyright}}

+` +} diff --git a/sengkuni-temporary_password.go b/sengkuni-temporary_password.go new file mode 100644 index 0000000..85b52e8 --- /dev/null +++ b/sengkuni-temporary_password.go @@ -0,0 +1,239 @@ +package hermes + +// Flat is a theme +type SengkuniTemporaryPassword struct{} + +// Name returns the name of the flat theme +func (dt *SengkuniTemporaryPassword) Name() string { + return "sengkuni_temporary_password" +} + +// HTMLTemplate returns a Golang template that will generate an HTML email. +func (dt *SengkuniTemporaryPassword) HTMLTemplate() string { + return ` + + + + + + + Document + + + + +
+
+ + +

Hello {{ .Email.Body.Registration.Name }},

+ {{ range $row := .Email.Body.Registration.Intros }} +

{{ $row }}

+ {{ end }} +
+ +
+

Your username is : {{.Email.Body.Registration.Username}}

+

Your temporary password is : {{.Email.Body.Registration.TemporaryPassword}}

+
+ +

{{ .Email.Body.Registration.Help }}

+
+

Best Regards,

+

{{ .Email.Body.Registration.Signature }}

+
+
+ + +
+ + + +` +} + +// PlainTextTemplate returns a Golang template that will generate an plain text email. +func (dt *SengkuniTemporaryPassword) PlainTextTemplate() string { + return `

{{if .Email.Body.Title }}{{ .Email.Body.Title }}{{ else }}{{ .Email.Body.Greeting }} {{ .Email.Body.Name }}{{ end }},

+{{ with .Email.Body.Intros }} + {{ range $line := . }} +

{{ $line }}

+ {{ end }} +{{ end }} +{{ if (ne .Email.Body.FreeMarkdown "") }} + {{ .Email.Body.FreeMarkdown.ToHTML }} +{{ else }} + {{ with .Email.Body.Dictionary }} + + {{ end }} + {{ with .Email.Body.Table }} + {{ $data := .Data }} + {{ $columns := .Columns }} + {{ if gt (len $data) 0 }} + + + {{ $col := index $data 0 }} + {{ range $entry := $col }} + + {{ end }} + + {{ range $row := $data }} + + {{ range $cell := $row }} + + {{ end }} + + {{ end }} +
{{ $entry.Key }}
+ {{ $cell.Value }} +
+ {{ end }} + {{ end }} + {{ with .Email.Body.Actions }} + {{ range $action := . }} +

+ {{ $action.Instructions }} + {{ if $action.InviteCode }} + {{ $action.InviteCode }} + {{ end }} + {{ if $action.Button.Link }} + {{ $action.Button.Link }} + {{ end }} +

+ {{ end }} + {{ end }} +{{ end }} +{{ with .Email.Body.Outros }} + {{ range $line := . }} +

{{ $line }}

+ {{ end }} +{{ end }} +

{{.Email.Body.Signature}},
{{.Hermes.Product.Name}} - {{.Hermes.Product.Link}}

+ +

{{.Hermes.Product.Copyright}}

+` +}