Make signup/login URLs configurable

Allows instances with LDAP/SSO setup to send users to the correct URLs
This commit is contained in:
Râu Cao 2024-08-22 21:28:02 +02:00
parent 6110ef33a0
commit b916182bc1
Signed by: raucao
GPG Key ID: 37036C356E56CC51
2 changed files with 11 additions and 3 deletions

View File

@ -50,12 +50,20 @@ module ApplicationHelper
def available_sign_up_path
if closed_registrations? || omniauth_only?
'https://joinmastodon.org/#getting-started'
ENV.fetch('SSO_ACCOUNT_SIGN_UP', 'https://joinmastodon.org/#getting-started')
else
ENV.fetch('SSO_ACCOUNT_SIGN_UP', new_user_registration_path)
end
end
def available_reset_password_path
ENV.fetch('SSO_ACCOUNT_RESET_PASSWORD', new_user_password_path)
end
def available_resend_confirmation_path
ENV.fetch('SSO_ACCOUNT_RESEND_CONFIRMATION', new_user_confirmation_path)
end
def omniauth_only?
ENV['OMNIAUTH_ONLY'] == 'true'
end

View File

@ -9,10 +9,10 @@
%li= link_to t('auth.register'), available_sign_up_path
- if controller_name != 'passwords' && controller_name != 'registrations'
%li= link_to t('auth.forgot_password'), new_user_password_path
%li= link_to t('auth.forgot_password'), available_reset_password_path
- if controller_name != 'confirmations' && (!user_signed_in? || !current_user.confirmed? || current_user.unconfirmed_email.present?)
%li= link_to t('auth.didnt_get_confirmation'), new_user_confirmation_path
%li= link_to t('auth.didnt_get_confirmation'), available_resend_confirmation_path
- if user_signed_in?
%li= link_to t('auth.logout'), destroy_user_session_path, data: { method: :delete }