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

Fix passwordless_sign_in bugs #179

Merged
merged 7 commits into from
Nov 9, 2023
Merged

Fix passwordless_sign_in bugs #179

merged 7 commits into from
Nov 9, 2023

Conversation

yshmarov
Copy link
Contributor

@yshmarov yshmarov commented Nov 8, 2023

failing tests at passwordless_sign_in(user) led me on such a trail....

  • @token was not being set correctly
  • we were using id instead of the identifier
  • minor improvements in the html template (email_field_tag provides basic validations)
bug

@mikker
Copy link
Owner

mikker commented Nov 8, 2023

Ugh no, that's a bug!

Can we fix the tests so they would've caught this?


session = Passwordless::Session.create!(authenticatable: user)
email = Passwordless::Mailer.sign_in(session)
assert_equal [user.email], email.to
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without these changes, error can be reproduced like this:

    session = Passwordless::Session.create!(authenticatable: user)
    email = Passwordless::Mailer.sign_in(session)
    assert_raises(ActionController::UrlGenerationError) do
      email.to
    end

Comment on lines +29 to +31
# UUID
add_column(:passwordless_sessions, :identifier, :string)
add_index(:passwordless_sessions, :identifier, unique: true)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

test/passwordless/test_helpers_test.rb Outdated Show resolved Hide resolved
@mikker mikker merged commit cd6ec4f into mikker:master Nov 9, 2023
3 checks passed
@mikker
Copy link
Owner

mikker commented Nov 9, 2023

Thank you once again ❤️🧡💛💚💙💜

@yshmarov yshmarov deleted the fix-test-auth-bugs branch February 10, 2024 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants