Change ability to navigate of unconfirmed users (#33209)

This commit is contained in:
Eugen Rochko 2024-12-09 09:31:56 +01:00 committed by GitHub
parent ca45f896dd
commit 796dd57e1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 21 additions and 19 deletions

View file

@ -70,7 +70,13 @@ class ApplicationController < ActionController::Base
end end
def require_functional! def require_functional!
redirect_to edit_user_registration_path unless current_user.functional? return if current_user.functional?
if current_user.confirmed?
redirect_to edit_user_registration_path
else
redirect_to auth_setup_path
end
end end
def skip_csrf_meta_tags? def skip_csrf_meta_tags?

View file

@ -78,5 +78,3 @@
.actions .actions
= f.button :button, @invite.present? ? t('auth.register') : sign_up_message, type: :submit = f.button :button, @invite.present? ? t('auth.register') : sign_up_message, type: :submit
.form-footer= render 'auth/shared/links'

View file

@ -27,5 +27,3 @@
- accept_path = @invite_code.present? ? public_invite_url(invite_code: @invite_code, accept: @accept_token) : new_user_registration_path(accept: @accept_token) - 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.accept'), accept_path, class: 'button'
= link_to t('auth.rules.back'), root_path, class: 'button button-tertiary' = link_to t('auth.rules.back'), root_path, class: 'button button-tertiary'
.form-footer= render 'auth/shared/links'

View file

@ -11,17 +11,17 @@
= render 'shared/error_messages', object: @user = render 'shared/error_messages', object: @user
%p.lead %details
%strong= t('auth.setup.link_not_received') %summary.lead
%p.lead= t('auth.setup.email_below_hint_html') %strong= t('auth.setup.link_not_received')
.fields-group %p.lead= t('auth.setup.email_below_hint_html')
= f.input :email,
hint: false,
input_html: { 'aria-label': t('simple_form.labels.defaults.email'), autocomplete: 'off' },
required: true
.actions .fields-group
= f.button :button, t('auth.resend_confirmation'), type: :submit, class: 'button timer-button', disabled: true = f.input :email,
hint: false,
input_html: { 'aria-label': t('simple_form.labels.defaults.email'), autocomplete: 'off', placeholder: t('simple_form.labels.defaults.email') },
required: true
.form-footer= render 'auth/shared/links' .actions
= f.button :button, t('auth.resend_confirmation'), type: :submit, class: 'button timer-button', disabled: true

View file

@ -1157,7 +1157,7 @@ en:
set_new_password: Set new password set_new_password: Set new password
setup: setup:
email_below_hint_html: Check your spam folder, or request another one. You can correct your email address if it's wrong. email_below_hint_html: Check your spam folder, or request another one. You can correct your email address if it's wrong.
email_settings_hint_html: Click the link we sent you to verify %{email}. We'll wait right here. email_settings_hint_html: Click the link we sent to %{email} to begin using Mastodon. We'll wait right here.
link_not_received: Didn't get a link? link_not_received: Didn't get a link?
new_confirmation_instructions_sent: You will receive a new email with the confirmation link in a few minutes! new_confirmation_instructions_sent: You will receive a new email with the confirmation link in a few minutes!
title: Check your inbox title: Check your inbox
@ -1166,7 +1166,7 @@ en:
title: Login to %{domain} title: Login to %{domain}
sign_up: 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}. 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 network, regardless of where their account is hosted. 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.
title: Let's get you set up on %{domain}. title: Let's get you set up on %{domain}.
status: status:
account_status: Account status account_status: Account status

View file

@ -34,7 +34,7 @@ RSpec.describe 'Log in' do
it 'A unconfirmed user is able to log in' do it 'A unconfirmed user is able to log in' do
fill_in_auth_details(email, password) fill_in_auth_details(email, password)
expect(subject).to have_css('div.admin-wrapper') expect(subject).to have_css('.title', text: I18n.t('auth.setup.title'))
end end
end end