mirror of
https://github.com/mastodon/mastodon.git
synced 2026-03-21 18:05:23 -05:00
Change server rules to be part of the sign-up form instead of separate page
This commit is contained in:
parent
64629eadb7
commit
817f1bec90
|
|
@ -13,7 +13,6 @@ class Auth::RegistrationsController < Devise::RegistrationsController
|
|||
before_action :set_strikes, only: [:edit, :update]
|
||||
before_action :require_not_suspended!, only: [:update]
|
||||
before_action :set_rules, only: :new
|
||||
before_action :require_rules_acceptance!, only: :new
|
||||
before_action :set_registration_form_time, only: :new
|
||||
|
||||
skip_before_action :check_self_destruct!, only: [:edit, :update]
|
||||
|
|
@ -127,16 +126,7 @@ class Auth::RegistrationsController < Devise::RegistrationsController
|
|||
|
||||
def set_rules
|
||||
@rules = Rule.ordered.includes(:translations)
|
||||
end
|
||||
|
||||
def require_rules_acceptance!
|
||||
return if @rules.empty? || validated_accept_token?
|
||||
|
||||
@accept_token = session[:accept_token] = SecureRandom.hex
|
||||
@invite_code = invite_code
|
||||
@rule_translations = @rules.map { |rule| rule.translation_for(I18n.locale) }
|
||||
|
||||
render :rules
|
||||
end
|
||||
|
||||
def validated_accept_token?
|
||||
|
|
|
|||
|
|
@ -34,39 +34,11 @@ $fluid-breakpoint: $maximum-width + 20px;
|
|||
counter-increment: list-counter;
|
||||
min-height: 4ch;
|
||||
|
||||
button {
|
||||
background: transparent;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
text-align: start;
|
||||
font: inherit;
|
||||
|
||||
&:hover,
|
||||
&:focus,
|
||||
&:active {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
&[aria-expanded='false'] .rules-list__hint {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
@supports (-webkit-line-clamp: 2) {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
white-space: normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&::before {
|
||||
content: counter(list-counter);
|
||||
position: absolute;
|
||||
inset-inline-start: 0;
|
||||
top: 1em;
|
||||
top: 1.3em;
|
||||
background: var(--color-bg-brand-base);
|
||||
color: var(--color-text-on-brand-base);
|
||||
border-radius: 50%;
|
||||
|
|
@ -91,6 +63,7 @@ $fluid-breakpoint: $maximum-width + 20px;
|
|||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
color: var(--color-text-secondary);
|
||||
margin-top: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1462,3 +1462,16 @@ code {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.rules-container {
|
||||
border: 1px solid var(--color-border-primary);
|
||||
border-radius: 8px;
|
||||
height: 200px;
|
||||
padding: 8px;
|
||||
overflow-y: scroll;
|
||||
margin-bottom: 30px;
|
||||
|
||||
.rules-list {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
= t('auth.captcha_confirmation.title')
|
||||
|
||||
= form_with url: auth_captcha_confirmation_url, class: :simple_form do |form|
|
||||
= render 'auth/shared/progress', stage: 'confirm'
|
||||
|
||||
= form.hidden_field :confirmation_token,
|
||||
value: params[:confirmation_token]
|
||||
= form.hidden_field :redirect_to_app,
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
- if resource.errors.of_kind?(:email, :already_confirmed)
|
||||
.simple_form
|
||||
= render 'auth/shared/progress', stage: resource.approved? ? 'completed' : 'confirmed'
|
||||
|
||||
- if resource.approved?
|
||||
%h1.title= t('auth.confirmations.welcome_title', name: resource.account.username)
|
||||
%p.lead= t('auth.confirmations.registration_complete', domain: site_hostname)
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@
|
|||
= render partial: 'shared/og', locals: { description: description_for_sign_up(@invite) }
|
||||
|
||||
= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { novalidate: false }) do |f|
|
||||
= render 'auth/shared/progress', stage: 'details'
|
||||
|
||||
%h1.title= t('auth.sign_up.title', domain: site_hostname)
|
||||
%p.lead= t('auth.sign_up.preamble')
|
||||
|
||||
|
|
@ -20,7 +18,6 @@
|
|||
.fields-group
|
||||
= f.simple_fields_for :account do |ff|
|
||||
= ff.input :username,
|
||||
append: "@#{site_hostname}",
|
||||
input_html: { autocomplete: 'off', pattern: '[a-zA-Z0-9_]+', maxlength: Account::USERNAME_LENGTH_LIMIT, placeholder: ' ' },
|
||||
required: true,
|
||||
wrapper: :with_label
|
||||
|
|
@ -76,6 +73,12 @@
|
|||
= hidden_field_tag :accept, params[:accept]
|
||||
= f.input :invite_code, as: :hidden
|
||||
|
||||
%p.lead= t('auth.sign_up.rules')
|
||||
|
||||
.rules-container
|
||||
%ol.rules-list
|
||||
= render collection: @rule_translations, partial: 'auth/rule_translations/rule_translation'
|
||||
|
||||
.fields-group
|
||||
= f.input :agreement,
|
||||
as: :boolean,
|
||||
|
|
|
|||
|
|
@ -1,25 +0,0 @@
|
|||
- content_for :page_title do
|
||||
= t('auth.register')
|
||||
|
||||
- content_for :header_tags do
|
||||
= render partial: 'shared/og', locals: { description: description_for_sign_up(@invite) }
|
||||
|
||||
.simple_form
|
||||
= render 'auth/shared/progress', stage: 'rules'
|
||||
|
||||
- if @invite.present? && @invite.autofollow?
|
||||
%h1.title= t('auth.rules.title_invited')
|
||||
%p.lead.invited-by= t('auth.rules.invited_by', domain: site_hostname)
|
||||
= render 'application/card', account: @invite.user.account, compact: true
|
||||
%p.lead= t('auth.rules.preamble_invited', domain: site_hostname)
|
||||
- else
|
||||
%h1.title= t('auth.rules.title')
|
||||
%p.lead= t('auth.rules.preamble', domain: site_hostname)
|
||||
|
||||
%ol.rules-list
|
||||
= render collection: @rule_translations, partial: 'auth/rule_translations/rule_translation'
|
||||
|
||||
.stacked-actions
|
||||
- accept_path = @invite_code.present? ? public_invite_url(invite_code: @invite_code, accept: @accept_token) : new_user_registration_path(accept: @accept_token)
|
||||
= link_to t('auth.rules.accept'), accept_path, class: 'button'
|
||||
= link_to t('auth.rules.back'), root_path, class: 'button button-secondary'
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
%li
|
||||
%button{ type: 'button', aria: { expanded: 'false' } }
|
||||
.rules-list__text= rule_translation.text
|
||||
.rules-list__hint= rule_translation.hint
|
||||
.rules-list__text= rule_translation.text
|
||||
.rules-list__hint= rule_translation.hint
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@
|
|||
= vite_typescript_tag 'sign_up.ts', crossorigin: 'anonymous'
|
||||
|
||||
= simple_form_for(@user, url: auth_setup_path) do |f|
|
||||
= render 'auth/shared/progress', stage: 'confirm'
|
||||
|
||||
%h1.title= t('auth.setup.title')
|
||||
%p.lead= t('auth.setup.email_settings_hint_html', email: content_tag(:strong, @user.email))
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,6 @@
|
|||
- progress_index = { rules: 0, details: 1, confirm: 2, confirmed: 3, completed: 4 }[stage.to_sym]
|
||||
- progress_index = { details: 1, confirm: 2, confirmed: 3, completed: 4 }[stage.to_sym]
|
||||
|
||||
%ol.progress-tracker
|
||||
%li{ class: progress_index.positive? ? 'completed' : 'active' }
|
||||
.circle
|
||||
- if progress_index.positive?
|
||||
= check_icon
|
||||
.label= t('auth.progress.rules')
|
||||
%li.separator{ class: progress_index.positive? ? 'completed' : nil }
|
||||
%li{ class: [progress_index > 1 && 'completed', progress_index == 1 && 'active'] }
|
||||
.circle
|
||||
- if progress_index > 1
|
||||
|
|
|
|||
|
|
@ -1310,6 +1310,7 @@ en:
|
|||
sign_up:
|
||||
manual_review: Sign-ups on %{domain} go through manual review by our moderators. To help us process your registration, write a bit about yourself and why you want an account on %{domain}.
|
||||
preamble: With an account on this Mastodon server, you'll be able to follow any other person on the fediverse, regardless of where their account is hosted.
|
||||
rules: 'Please mind the rules of this server:'
|
||||
title: Let's get you set up on %{domain}.
|
||||
status:
|
||||
account_status: Account status
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user