From 54cf68d8c6010484006a0e5ab4191ff44ef142e4 Mon Sep 17 00:00:00 2001 From: Z Date: Sat, 26 Sep 2020 11:29:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=89=8D=E7=AB=AF=E9=82=AE?= =?UTF-8?q?=E7=AE=B1=E6=AD=A3=E5=88=99=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/about/_registration.html.haml | 3 ++- app/views/auth/registrations/new.html.haml | 3 ++- config/initializers/new_features.rb | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) 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]'}