-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from fablabbcn/feature/require-email-confirmat…
…ion-on-signup Feature/require email confirmation on signup
- Loading branch information
Showing
18 changed files
with
120 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v14.21.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ruby 2.7.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Users::RegistrationsController < Devise::RegistrationsController | ||
invisible_captcha only: [:create] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class AddConfirmableToDevise < ActiveRecord::Migration[6.1] | ||
def change | ||
add_column :users, :confirmation_token, :string | ||
add_column :users, :confirmed_at, :datetime | ||
add_column :users, :confirmation_sent_at, :datetime | ||
add_column :users, :unconfirmed_email, :string | ||
execute "UPDATE users SET confirmed_at = NOW()" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,6 @@ | |
"webpack-dev-server": "^3.11.2" | ||
}, | ||
"engines" : { | ||
"node": "14.21.2" | ||
"node": "14.21.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,13 +3,15 @@ | |
one: | ||
m_id: MyString | ||
email: [email protected] | ||
first_name: Admin | ||
first_name: Administrator | ||
last_name: Adminson | ||
is_admin: true | ||
confirmed_at: 2023-12-01T14:00:00Z | ||
|
||
two: | ||
m_id: MyString | ||
email: [email protected] | ||
first_name: normal | ||
last_name: normalson | ||
is_admin: false | ||
confirmed_at: 2023-12-01T14:00:00Z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
require "application_system_test_case" | ||
|
||
class SignUpTest < ApplicationSystemTestCase | ||
setup do | ||
@user = users(:one) | ||
@user.password = "password123" | ||
@user.password_confirmation = "password123" | ||
@user.save! | ||
logout | ||
end | ||
|
||
test "Confirmed user logs in" do | ||
visit new_user_session_url | ||
|
||
fill_in "Email", with: @user.email | ||
fill_in "Password", with: "password123" | ||
|
||
within "#new_user" do | ||
click_on "Log in" | ||
end | ||
|
||
assert_text "Signed in successfully." | ||
end | ||
|
||
test "Unconfirmed user logs in" do | ||
@user.confirmed_at = nil | ||
@user.save! | ||
|
||
visit new_user_session_url | ||
|
||
fill_in "Email", with: @user.email | ||
fill_in "Password", with: "password123" | ||
|
||
within "#new_user" do | ||
click_on "Log in" | ||
end | ||
|
||
assert_text "You have to confirm your email address before continuing." | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
require "application_system_test_case" | ||
|
||
class SignUpTest < ApplicationSystemTestCase | ||
test "Signing up" do | ||
logout | ||
visit new_user_registration_url | ||
|
||
fill_in "Email", with: "[email protected]" | ||
fill_in "Password", with: "password123", match: :prefer_exact | ||
fill_in "Password confirmation", with: "password123" | ||
sleep 4 # The invisible_captcha bot protection will kick in if this is too quick | ||
click_on "Get Started" | ||
|
||
user = User.last | ||
assert_equal user.email, "[email protected]" | ||
|
||
visit user_confirmation_url(confirmation_token: user.confirmation_token) | ||
assert_text "Your email address has been successfully confirmed." | ||
end | ||
end |