]> git.openstreetmap.org Git - rails.git/commitdiff
Remove email confirmation field in signup form
authorMilan Cvetkovic <mcvetkovic@microsoft.com>
Tue, 12 Dec 2023 09:47:54 +0000 (09:47 +0000)
committerTom Hughes <tom@compton.nu>
Sat, 27 Apr 2024 11:44:09 +0000 (12:44 +0100)
app/controllers/users_controller.rb
app/models/user.rb
app/views/users/new.html.erb
config/locales/en.yml
test/controllers/users_controller_test.rb
test/integration/user_creation_test.rb
test/system/confirmation_resend_test.rb

index e1ecfef80a3a72e476e5df211ee31e016bfe8e49..4974d99f14a432da888bde7b511950af2f0bbbf3 100644 (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],
       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])
                                    :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
   ##
   # 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)
                                  :auth_provider, :auth_uid,
                                  :pass_crypt, :pass_crypt_confirmation,
                                  :consider_pd)
index 45ecbcc1b1360476b549285d51171f286c57f148..192f52ac4e74ebd440d073d9b8676b0799699c90 100644 (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? }
                            :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? },
   validates :email, :if => proc { |u| u.email_changed? },
                     :uniqueness => { :case_sensitive => false }
   validates :email, :if => proc { |u| u.email_changed? },
index 7335301043f809a416fdc2a2998994cbe6ba9cd9..0d3160a8c2127c915d371095ecd888ea2cd5ddcb 100644 (file)
   <%= bootstrap_form_for current_user, :url => { :action => "create" } do |f| %>
     <%= hidden_field_tag("referer", h(@referer)) unless @referer.nil? %>
 
   <%= 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">
 
     <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>
 
       </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"),
 
     <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">
                                                                         :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">
     </div>
 
     <div class="mb-3">
index fdb5e3f49a434d3b268c400bb24c59955d1081aa..25bab6cf0b38ddc472d6a54a4994fe2a2135bc7c 100644 (file)
@@ -142,7 +142,6 @@ en:
         auth_provider: Authentication Provider
         auth_uid: Authentication UID
         email: "Email"
         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"
         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!"
       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
       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
index 0c2d7d3427443831584f003e0b8c16662008d481..c5566e65db4ae534015fa97331fba7c6f2c7fd05 100644 (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 "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
             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
index 8b6cdb19c0c5a3063e9b6936f1300b7d588ae9d6..370886e5da086b1759aaaae24c5320323cc51089 100644 (file)
@@ -32,7 +32,6 @@ class UserCreationTest < ActionDispatch::IntegrationTest
         perform_enqueued_jobs do
           post "/user/new",
                :params => { :user => { :email => dup_email,
         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",
                                        :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,
         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" } }
                                        :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,
         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" } }
                                        :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,
         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",
                                        :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,
         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,
                                        :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,
         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",
                                        :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,
         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",
                                        :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,
         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",
                                        :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,
         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,
                                        :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,
         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 => "",
                                        :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,
         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",
                                        :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,
         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,
                                        :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,
         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 => "",
                                        :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,
         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",
                                        :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,
         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,
                                        :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,
         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 => "",
                                        :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,
         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",
                                        :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,
         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,
                                        :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,
         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 => "",
                                        :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,
         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",
                                        :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,
         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,
                                        :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,
         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 => "",
                                        :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,
         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",
                                        :display_name => display_name,
                                        :auth_provider => "wikipedia",
                                        :pass_crypt => "testtest",
index 746338dbcd94cd1bf522545bbbac948c4707c889..6ef85818ada8e21a39ae25ac2d1f45e252992d47 100644 (file)
@@ -7,7 +7,6 @@ class ConfirmationResendSystemTest < ApplicationSystemTestCase
 
     within ".new_user" do
       fill_in "Email", :with => @user.email
 
     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"
       fill_in "Display Name", :with => @user.display_name
       fill_in "Password", :with => "testtest"
       fill_in "Confirm Password", :with => "testtest"