sorcery
sorcery copied to clipboard
Why do I have to call `authenticates_with_sorcery!`?
Recently I've started wondering why I need to set the relation between the Sorcery and User class twice. First time, when I set user_class
attribute in initializer, and second time, when I call authenticates_with_sorcery!
in model.
Although potential issues are rare, rather easy to detect and fix, this just does not feel right to me and I think we should improve the design here.
I think we should do following:
- Deprecate and later remove
user_class
setting from initializer -
authenticates_with_sorcery!
should set the class it's called in as auser_class
variable for config (we could rename it tomodel_class
to avoid confusion or something) - Config class should raise an error if
authenticates_with_sorcery!
is called twice (for users who try to have separate user classes)
- Deprecate and later remove user_class setting from initializer
I fully agreed with this. user_class is bad when you have, for example, users and admins - two different models, but both needs authentification.