-
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.
- Loading branch information
1 parent
8dbd4e1
commit 6cd6cf1
Showing
27 changed files
with
177 additions
and
17 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 |
---|---|---|
|
@@ -31,7 +31,7 @@ jobs: | |
run: | | ||
touch ./app-rails/.env | ||
- run: make lint | ||
- run: make lint-ci | ||
|
||
test: | ||
name: Test | ||
|
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 |
---|---|---|
@@ -1 +1 @@ | ||
9d6d8a4d8e0eef78bfee45ee8451b694897cf4e4 | ||
c7e83faf7f305fd04fe439e375333d3dd1c7c318 |
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 |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
/.env* | ||
/*.env* | ||
!/.env*.erb | ||
!/*.env*.example | ||
|
||
# Ignore all logfiles and tempfiles. | ||
/log/* | ||
|
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
class Users::ForgotPasswordForm | ||
include ActiveModel::Model | ||
|
||
attr_accessor :email | ||
attr_accessor :email, :spam_trap | ||
|
||
validates :email, format: { with: URI::MailTo::EMAIL_REGEXP } | ||
|
||
validates :spam_trap, absence: true | ||
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
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,44 @@ | ||
############################ | ||
# Rails | ||
############################ | ||
|
||
RAILS_ENV=development | ||
|
||
############################ | ||
# Rails: Urls | ||
############################ | ||
|
||
APP_HOST=localhost | ||
APP_PORT=3000 | ||
|
||
############################ | ||
# AWS services | ||
############################ | ||
|
||
AWS_ACCESS_KEY_ID=<FILL ME IN> | ||
AWS_SECRET_ACCESS_KEY=<FILL ME IN> | ||
AWS_DEFAULT_REGION=<FILL ME IN> | ||
|
||
############################ | ||
# File storage | ||
############################ | ||
|
||
# Uncomment and fill in an AWS S3 bucket name to use S3 for file storage | ||
# BUCKET_NAME=<FILL ME IN> | ||
|
||
############################ | ||
# Auth | ||
############################ | ||
|
||
COGNITO_USER_POOL_ID=<FILL ME IN> | ||
COGNITO_CLIENT_ID=<FILL ME IN> | ||
COGNITO_CLIENT_SECRET=<FILL ME IN> | ||
|
||
############################ | ||
# Database | ||
############################ | ||
|
||
DB_HOST=127.0.0.1 | ||
DB_NAME=app_rails | ||
DB_USER=app_rails | ||
DB_PASSWORD=secret123 |
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 |
---|---|---|
|
@@ -44,6 +44,15 @@ | |
|
||
expect(response.status).to eq(422) | ||
end | ||
|
||
it "handles submission by bots" do | ||
post :send_reset_password_instructions, params: { | ||
users_forgot_password_form: { email: "[email protected]", spam_trap: "I am a bot" }, | ||
locale: "en" | ||
} | ||
|
||
expect(response.status).to eq(422) | ||
end | ||
end | ||
|
||
describe "GET reset" do | ||
|
@@ -95,5 +104,19 @@ | |
|
||
expect(response.status).to eq(422) | ||
end | ||
|
||
it "handles submission by bots" do | ||
post :confirm_reset, params: { | ||
users_reset_password_form: { | ||
email: "[email protected]", | ||
code: "123456", | ||
password: "password", | ||
spam_trap: "I am a bot" | ||
}, | ||
locale: "en" | ||
} | ||
|
||
expect(response.status).to eq(422) | ||
end | ||
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 |
---|---|---|
|
@@ -71,6 +71,22 @@ | |
|
||
expect(response.status).to eq(422) | ||
end | ||
|
||
it "handles submission by bots" do | ||
email = "[email protected]" | ||
|
||
post :create, params: { | ||
users_registration_form: { | ||
email: email, | ||
password: "password", | ||
role: "employer", | ||
spam_trap: "I am a bot" | ||
}, | ||
locale: "en" | ||
} | ||
|
||
expect(response.status).to eq(422) | ||
end | ||
end | ||
|
||
describe "GET new_account_verification" do | ||
|
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 |
---|---|---|
|
@@ -91,6 +91,21 @@ | |
expect(session[:challenge_email]).to eq("[email protected]") | ||
expect(response).to redirect_to(session_challenge_path) | ||
end | ||
|
||
it "handles submission by bots" do | ||
create(:user, uid: uid) | ||
|
||
post :create, params: { | ||
users_new_session_form: { | ||
email: "[email protected]", | ||
password: "password", | ||
spam_trap: "I am a bot" | ||
}, | ||
locale: "en" | ||
} | ||
|
||
expect(response.status).to eq(422) | ||
end | ||
end | ||
|
||
describe "GET challenge" do | ||
|
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 |
---|---|---|
|
@@ -29,4 +29,15 @@ | |
expect(form).not_to be_valid | ||
expect(form.errors.of_kind?(:email, :invalid)).to be_truthy | ||
end | ||
|
||
it "requires the honeypot field to be empty" do | ||
form = Users::NewSessionForm.new( | ||
email: "[email protected]", | ||
password: "password", | ||
spam_trap: "I am a bot" | ||
) | ||
|
||
expect(form).not_to be_valid | ||
expect(form.errors.of_kind?(:spam_trap, :present)).to be_truthy | ||
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 |
---|---|---|
|
@@ -36,4 +36,13 @@ | |
expect(form).not_to be_valid | ||
expect(form.errors.of_kind?(:email, :invalid)).to be_truthy | ||
end | ||
|
||
it "requires the honeypot field is empty" do | ||
form.email = "[email protected]" | ||
form.password = valid_password | ||
form.spam_trap = "I am a bot" | ||
|
||
expect(form).not_to be_valid | ||
expect(form.errors.of_kind?(:spam_trap, :present)).to be_truthy | ||
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