two_factor_authentication icon indicating copy to clipboard operation
two_factor_authentication copied to clipboard

change prepend_before_action to before_action

Open jaspervandenberg opened this issue 5 years ago • 0 comments

The authenticate_scope! has been prepended to the callbacks list. It is not required to prepend this function and it sometimes even breaks some functionalities because it is prepended:

We have a default scope on our resource model that sets a tenant according to the domain name (using: https://github.com/ErwinM/acts_as_tenant). Setting the tenant value required for finding the correct user is done in a prepend_before_action of our own. Because of the default scope, the `authenticate_scope! method is not able to find the correct user, because the tenant has not been set yet.

I think that changing the prepend_before_action to before_action would be better as the developer is able to change scopes and perform other actions before the user lookup is done in authenticate_scope!.

jaspervandenberg avatar Jun 14 '19 14:06 jaspervandenberg