diff --git a/app/views/about/_registration.html.haml b/app/views/about/_registration.html.haml index 87f19f4ab..7eb841a3b 100644 --- a/app/views/about/_registration.html.haml +++ b/app/views/about/_registration.html.haml @@ -7,7 +7,8 @@ = account_fields.input :username, wrapper: :with_label, label: false, required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.username'), :autocomplete => 'off', placeholder: t('simple_form.labels.defaults.username'), pattern: '[a-zA-Z0-9_]+', maxlength: 30 }, append: "(@#{site_hostname})", hint: false, disabled: closed_registrations? - email_domain = Rails.configuration.x.email_default_domain - = f.input :email, wrapper: :with_label, label: false, required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.email'), :autocomplete => 'off', placeholder: t('simple_form.labels.defaults.email') }, append: "@#{email_domain}", hint: false, disabled: closed_registrations? + - email_regex = Rails.configuration.x.email_regex + = f.input :email, placeholder: t('simple_form.labels.defaults.email'), wrapper: :with_label, label: false, required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.email'), :autocomplete => 'off', pattern: "#{email_regex}" }, append: "@#{email_domain}", hint: false, disabled: closed_registrations? = f.input :password, placeholder: t('simple_form.labels.defaults.password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.password'), :autocomplete => 'off', :minlength => User.password_length.first, :maxlength => User.password_length.last }, hint: false, disabled: closed_registrations? = f.input :password_confirmation, placeholder: t('simple_form.labels.defaults.confirm_password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.confirm_password'), :autocomplete => 'off' }, hint: false, disabled: closed_registrations? diff --git a/app/views/auth/registrations/new.html.haml b/app/views/auth/registrations/new.html.haml index ff0ecbc66..526b89cb3 100644 --- a/app/views/auth/registrations/new.html.haml +++ b/app/views/auth/registrations/new.html.haml @@ -18,7 +18,8 @@ .fields-group - email_domain = Rails.configuration.x.email_default_domain - = f.input :email, wrapper: :with_label, label: t('simple_form.labels.defaults.email'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.email'), :autocomplete => 'off' }, append: "@#{email_domain}" + - email_regex = Rails.configuration.x.email_regex + = f.input :email, wrapper: :with_label, label: t('simple_form.labels.defaults.email'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.email'), :autocomplete => 'off', pattern: "#{email_regex}" }, append: "@#{email_domain}" .fields-group = f.input :password, wrapper: :with_label, label: t('simple_form.labels.defaults.password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.password'), :autocomplete => 'off', :minlength => User.password_length.first, :maxlength => User.password_length.last } diff --git a/config/initializers/new_features.rb b/config/initializers/new_features.rb index 61bf610fd..021a5caad 100644 --- a/config/initializers/new_features.rb +++ b/config/initializers/new_features.rb @@ -1,7 +1,8 @@ # frozen_string_literal: true Rails.application.configure do - config.x.email_default_domain = ENV.fetch('EMAIL_DEFAULT_DOMAIN') { '???.edu.cn' } + config.x.email_default_domain = ENV.fetch('EMAIL_DEFAULT_DOMAIN') { '' } + config.x.email_regex = ENV.fetch('EMAIL_REGEX') { '.+' } config.x.tree_address = ENV.fetch('TREE_ADDRESS') {''} config.x.tree_acc = ENV.fetch('TREE_ACC') {'0'} config.x.anon.tag = ENV.fetch('ANON_TAG') {'[mask]'}