Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown email sender config #225

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Add config option for sending paranoid email
  • Loading branch information
Dakota-Schramm committed May 3, 2024
commit 72f8d9b945903ad0aaa6fd610ad5d09f4b53b690
5 changes: 4 additions & 1 deletion app/controllers/passwordless/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@ def normalized_email_param
def handle_resource_not_found
if Passwordless.config.paranoid
@resource = authenticatable_class.new(email: normalized_email_param)
@skip_after_session_save_callback = true

if Passwordless.config.send_paranoid_email
@skip_after_session_save_callback = true
end
else
raise(
ActiveRecord::RecordNotFound,
Expand Down
1 change: 1 addition & 0 deletions lib/passwordless/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class Configuration
)

option :paranoid, default: false
option :send_paranoid_email, default: false

def initialize
set_defaults!
Expand Down
4 changes: 2 additions & 2 deletions test/dummy/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
t.datetime "claimed_at", precision: nil
t.string "token_digest", null: false
t.string "identifier", null: false
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["authenticatable_type", "authenticatable_id"], name: "authenticatable"
t.index ["identifier"], name: "index_passwordless_sessions_on_identifier", unique: true
end
Expand Down