diff --git a/appview/pages/pages.go b/appview/pages/pages.go index d8c9f475..ce43444d 100644 --- a/appview/pages/pages.go +++ b/appview/pages/pages.go @@ -178,6 +178,15 @@ func (p *Pages) parseProfileBase(top string) (*template.Template, error) { return p.parse(stack...) } +func (p *Pages) parseLoginBase(top string) (*template.Template, error) { + stack := []string{ + "layouts/base", + "layouts/loginbase", + top, + } + return p.parse(stack...) +} + func (p *Pages) executePlain(name string, w io.Writer, params any) error { tpl, err := p.parse(name) if err != nil { @@ -187,6 +196,15 @@ func (p *Pages) executePlain(name string, w io.Writer, params any) error { return tpl.Execute(w, params) } +func (p *Pages) executeLogin(name string, w io.Writer, params any) error { + tpl, err := p.parseLoginBase(name) + if err != nil { + return err + } + + return tpl.ExecuteTemplate(w, "layouts/base", params) +} + func (p *Pages) execute(name string, w io.Writer, params any) error { tpl, err := p.parseBase(name) if err != nil { @@ -237,7 +255,7 @@ type LoginParams struct { } func (p *Pages) Login(w io.Writer, params LoginParams) error { - return p.executePlain("user/login", w, params) + return p.executeLogin("user/login", w, params) } type SignupParams struct { @@ -245,11 +263,11 @@ type SignupParams struct { } func (p *Pages) Signup(w io.Writer, params SignupParams) error { - return p.executePlain("user/signup", w, params) + return p.executeLogin("user/signup", w, params) } func (p *Pages) CompleteSignup(w io.Writer) error { - return p.executePlain("user/completeSignup", w, nil) + return p.executeLogin("user/completeSignup", w, nil) } type TermsOfServiceParams struct { diff --git a/appview/pages/templates/layouts/loginbase.html b/appview/pages/templates/layouts/loginbase.html new file mode 100644 index 00000000..fd5bb86a --- /dev/null +++ b/appview/pages/templates/layouts/loginbase.html @@ -0,0 +1,26 @@ +{{ define "mainLayout" }} +
Sign in with a different account to add it to your account list.
-Sign in with a different account to add it to your account list.
+- {{ if eq .ErrorCode "access_denied" }} - You have not authorized the app. - {{ else if eq .ErrorCode "session" }} - Server failed to create user session. - {{ else if eq .ErrorCode "max_accounts" }} - You have reached the maximum of 20 linked accounts. Please remove an account before adding a new one. - {{ else }} - Internal Server error. - {{ end }} - Please try again. -
-- Don't have an account? Create an account on Tangled now! -
+ + + {{ if .ErrorCode }} ++ {{ if eq .ErrorCode "access_denied" }} + You have not authorized the app. + {{ else if eq .ErrorCode "session" }} + Server failed to create user session. + {{ else if eq .ErrorCode "max_accounts" }} + You have reached the maximum of 20 linked accounts. Please remove an account before adding a new one. + {{ else }} + Internal Server error. + {{ end }} + Please try again. +
++ Don't have an account? Create an account on Tangled now! +
- -+ By signing up, you agree to our Terms of Service and Privacy Policy. +
+ {{ end }}