From: Milan Cvetkovic Date: Tue, 12 Dec 2023 09:47:54 +0000 (+0000) Subject: Remove email confirmation field in signup form X-Git-Tag: live~96^2~9 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/f8a606869e50752b4112b1dbc88d80251e261b44 Remove email confirmation field in signup form --- diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index e1ecfef80..4974d99f1 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -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) diff --git a/app/models/user.rb b/app/models/user.rb index 45ecbcc1b..192f52ac4 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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? }, diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index 733530104..0d3160a8c 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -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 %>
- <%= 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) %>
<%= t ".auth no password" %>
- <%= 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 %>

<%= t(".by_signing_up_html", :tou_link => link_to(t("layouts.tou"), @@ -49,7 +48,7 @@ :target => :new)) %>

- <%= 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) %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index fdb5e3f49..25bab6cf0 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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 diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb index 0c2d7d342..c5566e65d 100644 --- a/test/controllers/users_controller_test.rb +++ b/test/controllers/users_controller_test.rb @@ -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 diff --git a/test/integration/user_creation_test.rb b/test/integration/user_creation_test.rb index 8b6cdb19c..370886e5d 100644 --- a/test/integration/user_creation_test.rb +++ b/test/integration/user_creation_test.rb @@ -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", diff --git a/test/system/confirmation_resend_test.rb b/test/system/confirmation_resend_test.rb index 746338dbc..6ef85818a 100644 --- a/test/system/confirmation_resend_test.rb +++ b/test/system/confirmation_resend_test.rb @@ -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"