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

Hardcoded email attribute #65

Open
stemps opened this issue Jul 23, 2024 · 1 comment
Open

Hardcoded email attribute #65

stemps opened this issue Jul 23, 2024 · 1 comment

Comments

@stemps
Copy link

stemps commented Jul 23, 2024

Currently devise-passwordless has a hard-coded assumption that email is the only authentication key. However, devise allows using other attributes for retrieving and authenticating the user

class CustomUser < ApplicationRecord
  devise :magic_link_authenticatable, :authentication_keys => [:username]
end

I have a use case where I have a user model with an email attribute but where the email address is present but is not a unique key. Instead a separate unique username is used to retrieve the user and send them a login link.

Other tools like active_admin use these authentication_keys to dynamically build the login form.

It would be nice if devise-passwordless would respect the authentication_keys config setting and use these attributes to build the magic link and for the permitted params in the Devise::Passwordless::SessionsController.

I am happy to submit a PR with this change, but wanted to check first if you are interested in incorporating this change.

@abevoelker
Copy link
Owner

abevoelker commented Jul 24, 2024 via email

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

No branches or pull requests

2 participants