diff --git a/res/template/account/patreon_confirm.html b/res/template/account/patreon_confirm.html new file mode 100644 index 0000000..6e00006 --- /dev/null +++ b/res/template/account/patreon_confirm.html @@ -0,0 +1,37 @@ +{{define "patreon_confirm"}} + +
+ {{template "meta_tags" "E-mail verification"}} + {{template "user_style" .}} + + + {{template "page_top" .}} + ++ Your account's e-mail address has been updated. +
+ {{else if eq .Other "not_found"}} ++ This e-mail change request does not exist or has expired. + Please try again if you still want to change your e-mail + address. +
+ {{else}} ++ Something went wrong while processing this request. Please + try again later. +
+ {{end}} +{{$field.DefaultValue}}
{{end}} {{end}} diff --git a/webcontroller/forms.go b/webcontroller/forms.go index 9448760..dffc0d2 100644 --- a/webcontroller/forms.go +++ b/webcontroller/forms.go @@ -91,6 +91,7 @@ const ( FieldTypeCurrentPassword FieldType = "current-password" FieldTypeNewPassword FieldType = "new-password" FieldTypeCaptcha FieldType = "captcha" + FieldTypeDescription FieldType = "description" ) // ReadInput reads the form of a request and fills in the values for each field. diff --git a/webcontroller/user_settings.go b/webcontroller/user_settings.go index 892bf61..ae70bb0 100644 --- a/webcontroller/user_settings.go +++ b/webcontroller/user_settings.go @@ -217,3 +217,83 @@ func (wc *WebController) usernameForm(td *TemplateData, r *http.Request) (f Form } return f } + +func (wc *WebController) patreonLinkForm(td *TemplateData, r *http.Request) (f Form) { + f.Name = "link_patreon_subscription" + f.Title = "Link Patreon pledge to pixeldrain account" + f.SubmitLabel = "Submit" + + if r.FormValue("key") == "" { + f.Submitted = true + f.SubmitMessages = []template.HTML{"Patron ID not found"} + return f + } + + patron, err := td.PixelAPI.PatreonByID(r.FormValue("key")) + if err != nil && err.Error() == "not_found" { + f.Submitted = true + f.SubmitMessages = []template.HTML{"Patron ID not found"} + return f + } else if err != nil { + f.Submitted = true + formAPIError(err, &f) + return f + } + + f.Fields = []Field{{ + Name: "1", + Label: "", + DefaultValue: "", + Description: "