From 9fb8a78f91adffd5f4d28df1270e407c25a7a16e Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Thu, 11 Apr 2024 11:45:53 +0200 Subject: [feature] New user sign-up via web page (#2796) * [feature] User sign-up form and admin notifs * add chosen + filtered languages to migration * remove stray comment * chosen languages schmosen schmanguages * proper error on local account missing --- web/source/css/base.css | 73 +++++++++++++++------------- web/template/about.tmpl | 36 +++++--------- web/template/authorize.tmpl | 37 +++++++------- web/template/confirm_email.tmpl | 33 +++++++++++++ web/template/confirmed.tmpl | 27 ----------- web/template/confirmed_email.tmpl | 30 ++++++++++++ web/template/email_confirm.tmpl | 12 +++-- web/template/email_new_signup.tmpl | 32 +++++++++++++ web/template/finalize.tmpl | 54 +++++++++++---------- web/template/index.tmpl | 1 + web/template/index_apps.tmpl | 3 +- web/template/index_register.tmpl | 41 ++++++++++++++++ web/template/index_what_is_this.tmpl | 5 +- web/template/oob.tmpl | 2 +- web/template/sign-in.tmpl | 6 +-- web/template/sign-up.tmpl | 93 ++++++++++++++++++++++++++++++++++++ web/template/signed-up.tmpl | 30 ++++++++++++ 17 files changed, 380 insertions(+), 135 deletions(-) create mode 100644 web/template/confirm_email.tmpl delete mode 100644 web/template/confirmed.tmpl create mode 100644 web/template/confirmed_email.tmpl create mode 100644 web/template/email_new_signup.tmpl create mode 100644 web/template/index_register.tmpl create mode 100644 web/template/sign-up.tmpl create mode 100644 web/template/signed-up.tmpl (limited to 'web') diff --git a/web/source/css/base.css b/web/source/css/base.css index 54754ff8c..ae9724661 100644 --- a/web/source/css/base.css +++ b/web/source/css/base.css @@ -407,30 +407,27 @@ pre, pre[class*="language-"] { } } -/*********************************** -***** SECTION 4: SHAMEFUL MESS ***** -************************************/ - -/* - EVERYTHING BELOW THIS POINT: - Should be moved somewhere else - to avoid cluttering up this file. -*/ - /* - Below section stylings are used - in transient/error templates. + Forms and sign-in / sign-up / confirm pages. */ -section.sign-in { +section.with-form { form { display: flex; flex-direction: column; gap: 1rem; - padding-bottom: 1rem; padding-top: 1rem; + p { + /* + We use gap so we don't + need top + bottom margins. + */ + margin-top: 0; + margin-bottom: 0; + } + label, input { padding-left: 0.2rem; } @@ -441,12 +438,41 @@ section.sign-in { gap: 0.4rem; } + .checkbox { + display: flex; + flex-direction: row-reverse; + gap: 0.4rem; + + & > input { + height: 100%; + width: 5%; + min-width: 1.2rem; + align-self: center; + } + } + .btn { + /* Visually separate buttons a bit */ margin-top: 1rem; } } } +/*********************************** +***** SECTION 4: SHAMEFUL MESS ***** +************************************/ + +/* + EVERYTHING BELOW THIS POINT: + Should be moved somewhere else + to avoid cluttering up this file. +*/ + +/* + Below section stylings are used + in transient pages + error templates. +*/ + section.error { word-break: break-word; margin-bottom: 0.5rem; @@ -470,25 +496,6 @@ section.oob-token { } } -/* - TODO: This is only used in the "finalize" - template for new signups; move this elsewhere - when that stuff is finished up. -*/ -.callout { - margin: 1.5rem 0; - border: .05rem solid $border-accent; - border-radius: .2rem; - padding: 0 .6rem .6rem; - .callout-title { - margin: 0 -.6rem; - padding: .6rem; - font-weight: bold; - background-color: $border-accent; - color: $gray1; - } -} - /* TODO: list and blocklist are only used in settings panel and on blocklist page; diff --git a/web/template/about.tmpl b/web/template/about.tmpl index 04b0b095f..d8a540d19 100644 --- a/web/template/about.tmpl +++ b/web/template/about.tmpl @@ -59,37 +59,26 @@ {{- end }} {{- end -}} -{{- define "registrationLimits" -}} -{{- if .instance.Registrations -}} - Registration is enabled; new signups can be submitted to this instance.
- {{- if .instance.ApprovalRequired -}} - Admin approval is required for new registrations. - {{- else -}} - Admin approval is not required for registrations; new signups will be automatically approved (pending email confirmation). - {{- end -}} -{{- else -}} - Registration is disabled; new signups are currently closed for this instance. -{{- end -}} -{{- end -}} - {{- define "customCSSLimits" -}} +Custom CSS is  {{- if .instance.Configuration.Accounts.AllowCustomCSS -}} -Users are allowed to set Custom CSS for their profiles. +enabled {{- else -}} -Custom CSS is not enabled for user profiles. +disabled {{- end -}} + on account profiles. {{- end -}} {{- define "statusLimits" -}} -Statuses can contain up to  -{{- .instance.Configuration.Statuses.MaxCharacters }} characters, and  -{{- .instance.Configuration.Statuses.MaxMediaAttachments }} media attachments. +Statuses can contain up to +{{- .instance.Configuration.Statuses.MaxCharacters }} characters, and +{{- .instance.Configuration.Statuses.MaxMediaAttachments }} media attachments. {{- end -}} {{- define "pollLimits" -}} -Polls can have up to  -{{- .instance.Configuration.Polls.MaxOptions }} options, with  -{{- .instance.Configuration.Polls.MaxCharactersPerOption }} characters per option. +Polls can have up to +{{- .instance.Configuration.Polls.MaxOptions }} options, with +{{- .instance.Configuration.Polls.MaxCharactersPerOption }} characters per option. {{- end -}} {{- with . }} @@ -102,6 +91,7 @@ Polls can have up to 
  • Contact
  • Features
  • Languages
  • +
  • Register an Account on {{ .instance.Title -}}
  • Rules
  • Terms and Conditions
  • Moderated Servers
  • @@ -145,10 +135,9 @@ Polls can have up to 

    Instance Features

    @@ -160,6 +149,7 @@ Polls can have up to  {{- end }} + {{- include "index_register.tmpl" . | indent 1 }}

    Instance Rules

    diff --git a/web/template/authorize.tmpl b/web/template/authorize.tmpl index 9be094137..2767c4efb 100644 --- a/web/template/authorize.tmpl +++ b/web/template/authorize.tmpl @@ -19,22 +19,25 @@ {{- with . }}
    -
    -

    Hi {{ .user -}}!

    -

    - Application - {{- if .appwebsite }} - {{- .appname -}} - {{- else }} - {{- .appname -}} - {{- end }} - would like to perform actions on your behalf, with scope - {{- .scope -}}. -

    -

    - To continue, the application will redirect to: {{- .redirect -}} -

    - -
    +
    +

    Authorize app

    +
    +

    Hi {{- .user -}}!

    +

    + Application + {{- if .appwebsite }} + {{- .appname -}} + {{- else }} + {{- .appname -}} + {{- end }} + would like to perform actions on your behalf, with scope + {{- .scope -}}. +

    +

    + To continue, the application will redirect to: {{- .redirect -}} +

    + +
    +
    {{- end }} \ No newline at end of file diff --git a/web/template/confirm_email.tmpl b/web/template/confirm_email.tmpl new file mode 100644 index 000000000..d1932acd9 --- /dev/null +++ b/web/template/confirm_email.tmpl @@ -0,0 +1,33 @@ +{{- /* +// GoToSocial +// Copyright (C) GoToSocial Authors admin@gotosocial.org +// SPDX-License-Identifier: AGPL-3.0-or-later +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . +*/ -}} + +{{- with . }} +
    +
    +

    Confirm email address

    +
    +

    + Hi {{- .username -}}! + Please click the button to confirm your email address {{- .email -}}. +

    + +
    +
    +
    +{{- end }} \ No newline at end of file diff --git a/web/template/confirmed.tmpl b/web/template/confirmed.tmpl deleted file mode 100644 index c1633a8fb..000000000 --- a/web/template/confirmed.tmpl +++ /dev/null @@ -1,27 +0,0 @@ -{{- /* -// GoToSocial -// Copyright (C) GoToSocial Authors admin@gotosocial.org -// SPDX-License-Identifier: AGPL-3.0-or-later -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -*/ -}} - -{{- with . }} -
    -
    -

    Email Address Confirmed

    -

    Thanks {{ .username -}}! Your email address {{- .email -}} has been confirmed.

    -

    -
    -{{- end }} \ No newline at end of file diff --git a/web/template/confirmed_email.tmpl b/web/template/confirmed_email.tmpl new file mode 100644 index 000000000..2dc605e4b --- /dev/null +++ b/web/template/confirmed_email.tmpl @@ -0,0 +1,30 @@ +{{- /* +// GoToSocial +// Copyright (C) GoToSocial Authors admin@gotosocial.org +// SPDX-License-Identifier: AGPL-3.0-or-later +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . +*/ -}} + +{{- with . }} +
    +
    +

    Email address confirmed

    +

    Email address {{- .email -}} is now confirmed!

    + {{- if not .approved }} +

    Once an admin has approved your sign-up, you will be able to log in and use your account.

    + {{- end }} +
    +
    +{{- end }} \ No newline at end of file diff --git a/web/template/email_confirm.tmpl b/web/template/email_confirm.tmpl index 17926fdde..7963cf631 100644 --- a/web/template/email_confirm.tmpl +++ b/web/template/email_confirm.tmpl @@ -17,12 +17,14 @@ // along with this program. If not, see . */ -}} -Hello {{.Username}}! +Hello {{ .Username -}}! -You are receiving this mail because you've requested an account on {{.InstanceURL}}. +You are receiving this mail because you've requested an account on {{ .InstanceURL -}}. -We just need to confirm that this is your email address. To confirm your email, paste the following in your browser's address bar: +To use your account, you must confirm that this is your email address. -{{.ConfirmLink}} +To confirm your email, paste the following in your browser's address bar: -If you believe you've been sent this email in error, feel free to ignore it, or contact the administrator of {{.InstanceURL}} +{{ .ConfirmLink }} + +If you believe you've been sent this email in error, feel free to ignore it, or contact the administrator of {{ .InstanceURL -}}. diff --git a/web/template/email_new_signup.tmpl b/web/template/email_new_signup.tmpl new file mode 100644 index 000000000..b01d577d6 --- /dev/null +++ b/web/template/email_new_signup.tmpl @@ -0,0 +1,32 @@ +{{- /* +// GoToSocial +// Copyright (C) GoToSocial Authors admin@gotosocial.org +// SPDX-License-Identifier: AGPL-3.0-or-later +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . +*/ -}} + +Hello moderator of {{ .InstanceName }} ({{ .InstanceURL }})! + +Someone has submitted a new account sign-up to your instance. + +They provided the following details: + +Email address: {{ .SignupEmail }} +Username: {{ .SignupUsername }} +{{- if .SignupReason }} +Reason: {{ .SignupReason }} +{{- end }} + +To view the sign-up, paste the following link into your browser: {{ .SignupURL }} diff --git a/web/template/finalize.tmpl b/web/template/finalize.tmpl index 56ab677e5..861dc635f 100644 --- a/web/template/finalize.tmpl +++ b/web/template/finalize.tmpl @@ -19,29 +19,35 @@ {{- with . }}
    -
    -

    Hi {{ .name -}}!

    -

    - You are about to sign-up to {{ .instance.Title -}}. - To ensure the best experience for you, we need you to provide some additional details. -

    -
    -

    Important

    -

    Due to the way the ActivityPub standard works, you cannot change your username after it has been set.

    -
    -
    - - -
    - - -
    +
    +

    Finalize sign-in to {{ .instance.Title -}}

    +
    +

    + Hi {{- .name -}}! +

    +

    + You are about to create an account on {{- .instance.Title -}}. + To finish the process, you must select your username. +

    +
    + + +
    + + +
    +
    {{- end }} \ No newline at end of file diff --git a/web/template/index.tmpl b/web/template/index.tmpl index 80245fe5a..358bc081e 100644 --- a/web/template/index.tmpl +++ b/web/template/index.tmpl @@ -35,6 +35,7 @@
    {{- include "index_what_is_this.tmpl" . | indent 1 }} + {{- include "index_register.tmpl" . | indent 1 }} {{- include "index_apps.tmpl" . | indent 1 }} {{- end }} \ No newline at end of file diff --git a/web/template/index_apps.tmpl b/web/template/index_apps.tmpl index 8f1e434e0..19a474692 100644 --- a/web/template/index_apps.tmpl +++ b/web/template/index_apps.tmpl @@ -22,8 +22,9 @@

    Client applications

    + Have an account on this instance and want to log in? GoToSocial does not provide its own webclient, but implements the Mastodon client API. - You can use this server through a variety of other clients: + You can use a variety of clients to log in to your account here:

    + {{- if .instance.Registrations }} +

    Or, just register for an account on this instance!

    + {{- end }}
    {{- end }} \ No newline at end of file diff --git a/web/template/oob.tmpl b/web/template/oob.tmpl index ff36582e7..05a639ec0 100644 --- a/web/template/oob.tmpl +++ b/web/template/oob.tmpl @@ -20,7 +20,7 @@ {{- with . }}
    -

    Hi {{ .user -}}!

    +

    Hi {{- .user -}}!

    Here's your out-of-band token with scope "{{- .scope -}}", use it wisely:

    {{- .oobToken -}}
    diff --git a/web/template/sign-in.tmpl b/web/template/sign-in.tmpl index 916d6942f..6362359cb 100644 --- a/web/template/sign-in.tmpl +++ b/web/template/sign-in.tmpl @@ -19,16 +19,16 @@ {{- with . }}
    -