-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 resource.provider in RegistrationsController? #997
Comments
Hey @m4-miranda sure, I agree with your logic here. Mind opening a pull request to illustrate your exact changes in mind? |
If you make a PR, you can reuse the |
@MaicolBen It isn't possible to override the concern, is it? I could modify the get_resource method to accept a provider parameter, but the method would have to be declared in each controller |
You can override it in your code, and yes, you have to do it in every controller (you can make a concern in your code to avoid repeating) |
Closed via #998 |
This gotcha really screwed me up. It would be really nice for This way I could add 'provider' as a permitted param to configure and use it as I wish with expected behaviour. I lost many hours trying to figure out why my user model kept hardcoding provider to 'email'. Similar to |
Sorry to hear that, as we don't have a lot of code documentation, you need to read the source code, in case of the provider, you can override with what was defined in #975 |
@MaicolBen Thanks for getting back. My intention is to have
unexpectedly modify and break my User model elsewhere on subsequent updates to a user (like password resets or logins)? (Overall I'm skeptical why this code was moved into a concern at all, as it seems to make extensibility and customization of each controller more unclear and difficult.) |
I tried modifying the gem to override the registrations controller code from something like this: module DeviseTokenAuth
class RegistrationsController < DeviseTokenAuth::ApplicationController
def create
@resource = resource_class.new(sign_up_params.except(:confirm_success_url))
@resource.provider = provider over to this: module DeviseTokenAuth
class RegistrationsController < DeviseTokenAuth::ApplicationController
def create
@resource = resource_class.new(sign_up_params.except(:confirm_success_url))
if sign_up_params[:provider].present?
@resource.provider = sign_up_params[:provider]
else
@resource.provider = provider
end but it didn't work and I still get back an |
That's happening because you aren't saving the provider in the resource, which it isn't a good solution. I believe this has been worked on #990, but we need it finished in order to use it. In fact, we put a bounty on it in order to get it ASAP |
The resource.provider field in Registrations#create is hardcoded to 'email'. Shouldn't this be obtained from Devise?
I'm trying to get rid of email dependency altogether
The text was updated successfully, but these errors were encountered: