From b2232f74129173f8d67340267d31962a82c1e37c Mon Sep 17 00:00:00 2001 From: robdel12 Date: Sat, 30 Sep 2017 18:33:12 -0500 Subject: [PATCH 1/3] Create failing test case --- spec/features/signup_spec.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/spec/features/signup_spec.rb b/spec/features/signup_spec.rb index b6367b88e17..917fad74ef1 100644 --- a/spec/features/signup_spec.rb +++ b/spec/features/signup_spec.rb @@ -24,6 +24,24 @@ feature 'Signup' do end end + context "when sigining up with different cased emails" do + it "creates the user successfully" do + user = build(:user) + + visit root_path + + fill_in 'new_user_name', with: user.name + fill_in 'new_user_username', with: user.username + fill_in 'new_user_email', with: user.email + fill_in 'new_user_email_confirmation', with: user.email.capitalize + fill_in 'new_user_password', with: user.password + click_button "Register" + + expect(current_path).to eq dashboard_projects_path + expect(page).to have_content("Welcome! You have signed up successfully.") + end + end + context "when not sending confirmation email" do before do stub_application_setting(send_user_confirmation_email: false) From c82678ca76dc0f44eea165d73598454a01bf3be6 Mon Sep 17 00:00:00 2001 From: robdel12 Date: Sat, 30 Sep 2017 18:34:26 -0500 Subject: [PATCH 2/3] Add `:email_confirmation` to devise `insensitive_keys` This fixes a bug where the email confirmation input value is case sensative. For example, if the email input is `myemail@example.com` and the email confirmation input is `Myemail@example.com` the form would fail to submit. --- config/initializers/devise.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 3aed2136f1b..0ba0d791054 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -36,7 +36,7 @@ Devise.setup do |config| # Configure which authentication keys should be case-insensitive. # These keys will be downcased upon creating or modifying a user and when used # to authenticate or find a user. Default is :email. - config.case_insensitive_keys = [:email] + config.case_insensitive_keys = [:email, :email_confirmation] # Configure which authentication keys should have whitespace stripped. # These keys will have whitespace before and after removed upon creating or From de4e573564a8e0a25d3c0f6e111588a618441ab5 Mon Sep 17 00:00:00 2001 From: robdel12 Date: Sat, 30 Sep 2017 21:48:59 -0500 Subject: [PATCH 3/3] Add new changelog entry --- .../unreleased/rd-fix-case-sensative-email-conf-signup.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelogs/unreleased/rd-fix-case-sensative-email-conf-signup.yml diff --git a/changelogs/unreleased/rd-fix-case-sensative-email-conf-signup.yml b/changelogs/unreleased/rd-fix-case-sensative-email-conf-signup.yml new file mode 100644 index 00000000000..69695e403a9 --- /dev/null +++ b/changelogs/unreleased/rd-fix-case-sensative-email-conf-signup.yml @@ -0,0 +1,5 @@ +--- +title: Fix case sensitive email confirmation on signup +merge_request: 14606 +author: robdel12 +type: fixed