Creating a User when one does not exist #230
Closed
StevenClontz
started this conversation in
General
Replies: 2 comments
-
Ah, it just clicked that the example at https://github.com/mikker/passwordless?tab=readme-ov-file#looking-up-the-user does exactly this. class User < ApplicationRecord
def self.fetch_resource_for_passwordless(email)
find_or_create_by(email: email)
end
end |
Beta Was this translation helpful? Give feedback.
0 replies
-
Yes, the suggested approach is to just roll your own logic. Use the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Many users of my app will only use it once or twice a year, and likely won't even remember if they have a User or not. I'd like to have a pattern where they provide their email, and then they either enter the token or click the magic link sent to their email, and once that's done, either they are logged into their existing User, or a User is created for them. Has anyone used passwordless for such an approach?
Beta Was this translation helpful? Give feedback.
All reactions