Remove email confirmation field in signup form

This commit is contained in:
Milan Cvetkovic 2023-12-12 09:47:54 +00:00 committed by Tom Hughes
parent 1276fb944a
commit f8a606869e
7 changed files with 14 additions and 42 deletions

View file

@ -70,7 +70,6 @@ class UsersController < ApplicationController
redirect_to @referer || { :controller => "site", :action => "index" }
elsif params.key?(:auth_provider) && params.key?(:auth_uid)
self.current_user = User.new(:email => params[:email],
:email_confirmation => params[:email],
:display_name => params[:nickname],
:auth_provider => params[:auth_provider],
:auth_uid => params[:auth_uid])
@ -336,7 +335,7 @@ class UsersController < ApplicationController
##
# return permitted user parameters
def user_params
params.require(:user).permit(:email, :email_confirmation, :display_name,
params.require(:user).permit(:email, :display_name,
:auth_provider, :auth_uid,
:pass_crypt, :pass_crypt_confirmation,
:consider_pd)

View file

@ -100,7 +100,7 @@ class User < ApplicationRecord
:whitespace => { :leading => false, :trailing => false },
:width => { :minimum => 3 }
validate :display_name_cannot_be_user_id_with_other_id, :if => proc { |u| u.display_name_changed? }
validates :email, :presence => true, :confirmation => true, :characters => true
validates :email, :presence => true, :characters => true
validates :email, :if => proc { |u| u.email_changed? },
:uniqueness => { :case_sensitive => false }
validates :email, :if => proc { |u| u.email_changed? },

View file

@ -19,26 +19,25 @@
<%= bootstrap_form_for current_user, :url => { :action => "create" } do |f| %>
<%= hidden_field_tag("referer", h(@referer)) unless @referer.nil? %>
<%= f.email_field :email, :tabindex => 1 %>
<%= f.email_field :email_confirmation, :help => t(".email_confirmation_help_html",
:privacy_policy_link => link_to(t(".privacy_policy"),
t(".privacy_policy_url"),
:title => t(".privacy_policy_title"))),
:tabindex => 2 %>
<%= f.email_field :email, :help => t(".email_help_html",
:privacy_policy_link => link_to(t(".privacy_policy"),
t(".privacy_policy_url"),
:title => t(".privacy_policy_title"))),
:tabindex => 1 %>
<%= f.text_field :display_name, :help => t(".display name description"), :tabindex => 3 %>
<%= f.text_field :display_name, :help => t(".display name description"), :tabindex => 2 %>
<fieldset class="mb-3" id="auth_field">
<label for="user_auth_provider" class="form-label"><%= t(".external auth") %></label>
<div class="row">
<%= f.select(:auth_provider, Auth.providers, :default => "", :hide_label => true, :wrapper => { :class => "col-auto mb-0" }, :tabindex => 4) %>
<%= f.text_field(:auth_uid, :hide_label => true, :wrapper => { :class => "col mb-0" }, :tabindex => 5) %>
<%= f.select(:auth_provider, Auth.providers, :default => "", :hide_label => true, :wrapper => { :class => "col-auto mb-0" }, :tabindex => 3) %>
<%= f.text_field(:auth_uid, :hide_label => true, :wrapper => { :class => "col mb-0" }, :tabindex => 4) %>
</div>
<small class="form-text text-muted"><%= t ".auth no password" %></small>
</fieldset>
<%= f.password_field :pass_crypt, :tabindex => 6 %>
<%= f.password_field :pass_crypt_confirmation, :tabindex => 7 %>
<%= f.password_field :pass_crypt, :tabindex => 5 %>
<%= f.password_field :pass_crypt_confirmation, :tabindex => 6 %>
<p class="mb-3 text-muted"><%= t(".by_signing_up_html",
:tou_link => link_to(t("layouts.tou"),
@ -49,7 +48,7 @@
:target => :new)) %></p>
<div class="mb-3">
<%= submit_tag(t(".continue"), :name => "continue", :id => "continue", :class => "btn btn-primary", :tabindex => 8) %>
<%= submit_tag(t(".continue"), :name => "continue", :id => "continue", :class => "btn btn-primary", :tabindex => 7) %>
</div>
<div class="mb-3">

View file

@ -142,7 +142,6 @@ en:
auth_provider: Authentication Provider
auth_uid: Authentication UID
email: "Email"
email_confirmation: "Email Confirmation"
new_email: "New Email Address"
active: "Active"
display_name: "Display Name"
@ -2743,7 +2742,7 @@ en:
auth no password: "With third party authentication a password is not required, but some extra tools or server may still need one."
continue: Sign Up
terms accepted: "Thanks for accepting the new contributor terms!"
email_confirmation_help_html: 'Your address is not displayed publicly, see our %{privacy_policy_link} for more information.'
email_help_html: 'Your address is not displayed publicly, see our %{privacy_policy_link} for more information.'
privacy_policy: privacy policy
privacy_policy_url: https://wiki.osmfoundation.org/wiki/Privacy_Policy
privacy_policy_title: OSMF privacy policy including section on email addresses

View file

@ -82,7 +82,6 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
assert_select "div#content", :count => 1 do
assert_select "form[action='/user/new'][method='post']", :count => 1 do
assert_select "input[id='user_email']", :count => 1
assert_select "input[id='user_email_confirmation']", :count => 1
assert_select "input[id='user_display_name']", :count => 1
assert_select "input[id='user_pass_crypt'][type='password']", :count => 1
assert_select "input[id='user_pass_crypt_confirmation'][type='password']", :count => 1

View file

@ -32,7 +32,6 @@ class UserCreationTest < ActionDispatch::IntegrationTest
perform_enqueued_jobs do
post "/user/new",
:params => { :user => { :email => dup_email,
:email_confirmation => dup_email,
:display_name => display_name,
:pass_crypt => "testtest",
:pass_crypt_confirmation => "testtest",
@ -54,7 +53,6 @@ class UserCreationTest < ActionDispatch::IntegrationTest
perform_enqueued_jobs do
post "/user/new",
:params => { :user => { :email => email,
:email_confirmation => email,
:display_name => dup_display_name,
:pass_crypt => "testtest",
:pass_crypt_confirmation => "testtest" } }
@ -74,7 +72,6 @@ class UserCreationTest < ActionDispatch::IntegrationTest
perform_enqueued_jobs do
post "/user/new",
:params => { :user => { :email => email,
:email_confirmation => email,
:display_name => display_name,
:pass_crypt => "testtest",
:pass_crypt_confirmation => "blahblah" } }
@ -95,7 +92,6 @@ class UserCreationTest < ActionDispatch::IntegrationTest
perform_enqueued_jobs do
post "/user/new",
:params => { :user => { :email => new_email,
:email_confirmation => new_email,
:display_name => display_name,
:pass_crypt => "testtest",
:pass_crypt_confirmation => "testtest",
@ -151,7 +147,6 @@ class UserCreationTest < ActionDispatch::IntegrationTest
perform_enqueued_jobs do
post "/user/new",
:params => { :user => { :email => new_email,
:email_confirmation => new_email,
:display_name => display_name,
:pass_crypt => password,
:pass_crypt_confirmation => password,
@ -204,7 +199,6 @@ class UserCreationTest < ActionDispatch::IntegrationTest
perform_enqueued_jobs do
post "/user/new",
:params => { :user => { :email => new_email,
:email_confirmation => new_email,
:display_name => display_name,
:auth_provider => "openid",
:auth_uid => "http://localhost:1123/new.tester",
@ -238,7 +232,6 @@ class UserCreationTest < ActionDispatch::IntegrationTest
perform_enqueued_jobs do
post "/user/new",
:params => { :user => { :email => new_email,
:email_confirmation => new_email,
:display_name => display_name,
:auth_provider => "openid",
:auth_uid => "http://localhost:1123/new.tester",
@ -274,7 +267,6 @@ class UserCreationTest < ActionDispatch::IntegrationTest
perform_enqueued_jobs do
post "/user/new",
:params => { :user => { :email => new_email,
:email_confirmation => new_email,
:display_name => display_name,
:auth_provider => "openid",
:auth_uid => "http://localhost:1123/new.tester",
@ -333,7 +325,6 @@ class UserCreationTest < ActionDispatch::IntegrationTest
perform_enqueued_jobs do
post "/user/new",
:params => { :user => { :email => new_email,
:email_confirmation => new_email,
:display_name => display_name,
:auth_provider => "google",
:pass_crypt => password,
@ -366,7 +357,6 @@ class UserCreationTest < ActionDispatch::IntegrationTest
perform_enqueued_jobs do
post "/user/new",
:params => { :user => { :email => new_email,
:email_confirmation => new_email,
:display_name => display_name,
:auth_provider => "google",
:pass_crypt => "",
@ -403,7 +393,6 @@ class UserCreationTest < ActionDispatch::IntegrationTest
perform_enqueued_jobs do
post "/user/new",
:params => { :user => { :email => new_email,
:email_confirmation => new_email,
:display_name => display_name,
:auth_provider => "google",
:pass_crypt => "testtest",
@ -461,7 +450,6 @@ class UserCreationTest < ActionDispatch::IntegrationTest
perform_enqueued_jobs do
post "/user/new",
:params => { :user => { :email => new_email,
:email_confirmation => new_email,
:display_name => display_name,
:auth_provider => "facebook",
:pass_crypt => password,
@ -494,7 +482,6 @@ class UserCreationTest < ActionDispatch::IntegrationTest
perform_enqueued_jobs do
post "/user/new",
:params => { :user => { :email => new_email,
:email_confirmation => new_email,
:display_name => display_name,
:auth_provider => "facebook",
:pass_crypt => "",
@ -529,7 +516,6 @@ class UserCreationTest < ActionDispatch::IntegrationTest
perform_enqueued_jobs do
post "/user/new",
:params => { :user => { :email => new_email,
:email_confirmation => new_email,
:display_name => display_name,
:auth_provider => "facebook",
:pass_crypt => "testtest",
@ -587,7 +573,6 @@ class UserCreationTest < ActionDispatch::IntegrationTest
perform_enqueued_jobs do
post "/user/new",
:params => { :user => { :email => new_email,
:email_confirmation => new_email,
:display_name => display_name,
:auth_provider => "microsoft",
:pass_crypt => password,
@ -620,7 +605,6 @@ class UserCreationTest < ActionDispatch::IntegrationTest
perform_enqueued_jobs do
post "/user/new",
:params => { :user => { :email => new_email,
:email_confirmation => new_email,
:display_name => display_name,
:auth_provider => "microsoft",
:pass_crypt => "",
@ -655,7 +639,6 @@ class UserCreationTest < ActionDispatch::IntegrationTest
perform_enqueued_jobs do
post "/user/new",
:params => { :user => { :email => new_email,
:email_confirmation => new_email,
:display_name => display_name,
:auth_provider => "microsoft",
:pass_crypt => "testtest",
@ -713,7 +696,6 @@ class UserCreationTest < ActionDispatch::IntegrationTest
perform_enqueued_jobs do
post "/user/new",
:params => { :user => { :email => new_email,
:email_confirmation => new_email,
:display_name => display_name,
:auth_provider => "github",
:pass_crypt => password,
@ -746,7 +728,6 @@ class UserCreationTest < ActionDispatch::IntegrationTest
perform_enqueued_jobs do
post "/user/new",
:params => { :user => { :email => new_email,
:email_confirmation => new_email,
:display_name => display_name,
:auth_provider => "github",
:pass_crypt => "",
@ -781,7 +762,6 @@ class UserCreationTest < ActionDispatch::IntegrationTest
perform_enqueued_jobs do
post "/user/new",
:params => { :user => { :email => new_email,
:email_confirmation => new_email,
:display_name => display_name,
:auth_provider => "github",
:pass_crypt => "testtest",
@ -839,7 +819,6 @@ class UserCreationTest < ActionDispatch::IntegrationTest
perform_enqueued_jobs do
post "/user/new",
:params => { :user => { :email => new_email,
:email_confirmation => new_email,
:display_name => display_name,
:auth_provider => "wikipedia",
:pass_crypt => password,
@ -872,7 +851,6 @@ class UserCreationTest < ActionDispatch::IntegrationTest
perform_enqueued_jobs do
post "/user/new",
:params => { :user => { :email => new_email,
:email_confirmation => new_email,
:display_name => display_name,
:auth_provider => "wikipedia",
:pass_crypt => "",
@ -907,7 +885,6 @@ class UserCreationTest < ActionDispatch::IntegrationTest
perform_enqueued_jobs do
post "/user/new",
:params => { :user => { :email => new_email,
:email_confirmation => new_email,
:display_name => display_name,
:auth_provider => "wikipedia",
:pass_crypt => "testtest",

View file

@ -7,7 +7,6 @@ class ConfirmationResendSystemTest < ApplicationSystemTestCase
within ".new_user" do
fill_in "Email", :with => @user.email
fill_in "Email Confirmation", :with => @user.email
fill_in "Display Name", :with => @user.display_name
fill_in "Password", :with => "testtest"
fill_in "Confirm Password", :with => "testtest"