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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/store recognisable session on registration #106

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

quorauk
Copy link

@quorauk quorauk commented Aug 25, 2023

Changes

Stores a recognisable session on registration

I noticed that sessions aren't stored when a user first registers, so the first actual sign in works without hitting Guard

I'm not particularly comfortable with this change, so let me know if it has some horrid gotchas i'm not aware of 馃槢

Ticket

#105

Before submitting have you:

  • Included a link to any relevant ticket
  • Included links to any github issues
  • Prefix the title with the PR type (Feature, Bugfix, Documentation, Chore)

After submitting remember to:

  • Mark the ticket as ready for review
  • Include the PR on the ticket
  • Assign a single reviewer

@quorauk quorauk changed the title store recognisable session on registration Bugfix/store recognisable session on registration Aug 25, 2023
@quorauk quorauk marked this pull request as ready for review August 25, 2023 14:32
# After the user has been signed up, we save the ip address in the
# DeviseRecognisable::RecognisableSession table.
def store_recognisable_details
return unless resource.persisted?
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @quorauk! I think the main question I'd be asking is if we have some social proof that this is the right way to add a hook after #create e.g. this guard is enough to confirm that we should be creating a RecogniseableSession. Do you have anything you can point to?

def store_recognisable_details
return unless resource.persisted?
DeviseRecognisable::RecognisableSession.create!(
recognisable: resource_class.find_by(email: params[resource_name][:email]),
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason why you can't just pass resource here?

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