class Auth::RegistrationsController < Devise::RegistrationsController
layout :determine_layout
- before_action :check_single_user_mode
+ before_action :check_enabled_registrations, only: [:new, :create]
before_action :configure_sign_up_params, only: [:create]
protected
new_user_session_path
end
- def check_single_user_mode
- redirect_to root_path if Rails.configuration.x.single_user_mode
+ def check_enabled_registrations
+ redirect_to root_path if Rails.configuration.x.single_user_mode || !Setting.open_registrations
end
-
+
private
-
+
def determine_layout
%w(edit update).include?(action_name) ? 'admin' : 'auth'
end
.screenshot-with-signup
.mascot= image_tag 'fluffy-elephant-friend.png'
- = simple_form_for(@user, url: user_registration_path) do |f|
- = f.simple_fields_for :account do |ff|
- = ff.input :username, autofocus: true, placeholder: t('simple_form.labels.defaults.username'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.username') }
+ - if @open_registrations
+ = simple_form_for(@user, url: user_registration_path) do |f|
+ = f.simple_fields_for :account do |ff|
+ = ff.input :username, autofocus: true, placeholder: t('simple_form.labels.defaults.username'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.username') }
- = f.input :email, placeholder: t('simple_form.labels.defaults.email'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.email') }
- = f.input :password, autocomplete: "off", placeholder: t('simple_form.labels.defaults.password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.password') }
- = f.input :password_confirmation, autocomplete: "off", placeholder: t('simple_form.labels.defaults.confirm_password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.confirm_password') }
+ = f.input :email, placeholder: t('simple_form.labels.defaults.email'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.email') }
+ = f.input :password, autocomplete: "off", placeholder: t('simple_form.labels.defaults.password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.password') }
+ = f.input :password_confirmation, autocomplete: "off", placeholder: t('simple_form.labels.defaults.confirm_password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.confirm_password') }
- .actions
- = f.button :button, t('about.get_started'), type: :submit
+ .actions
+ = f.button :button, t('about.get_started'), type: :submit
- .info
- = link_to t('auth.login'), new_user_session_path, class: 'webapp-btn'
- ·
- = link_to t('about.about_this'), about_more_path
+ .info
+ = link_to t('auth.login'), new_user_session_path, class: 'webapp-btn'
+ ·
+ = link_to t('about.about_this'), about_more_path
+ - else
+ .closed-registrations-message
+ - if @closed_registrations_message.blank?
+ %p= t('about.closed_registrations')
+ - else
+ = @closed_registrations_message.html_safe
+ .info
+ = link_to t('auth.login'), new_user_session_path, class: 'webapp-btn'
+ ·
+ = link_to t('about.other_instances'), 'https://github.com/tootsuite/mastodon/blob/master/docs/Using-Mastodon/List-of-Mastodon-instances.md'
+ ·
+ = link_to t('about.about_this'), about_more_path
%h3= t('about.features_headline')
%br/
You can use HTML tags
%td= best_in_place @settings['site_extended_description'], :value, as: :textarea, url: admin_setting_path(@settings['site_extended_description'])
+ %tr
+ %td
+ %strong Open registration
+ %td= best_in_place @settings['open_registrations'], :value, as: :checkbox, collection: { false: 'Disabled', true: 'Enabled'}, url: admin_setting_path(@settings['open_registrations'])
+ %tr
+ %td
+ %strong Closed registration message
+ %br/
+ Displayed on frontpage when registrations are closed
+ %br/
+ You can use HTML tags
+ %td= best_in_place @settings['closed_registrations_message'], :value, as: :textarea, url: admin_setting_path(@settings['closed_registrations_message'])