Closed last-partizan closed 1 year ago
Hello.
We want to disable using SMS methods for admin users, but allow it for normal users.
Right now we're using overriden SetupView, with following code:
SetupView
class SetupView(two_factor.views.SetupView): condition_dict = { "method": lambda self: not self.__deny_sms_method(), } def __deny_sms_method(self): return self.request.user.is_staff def get_method(self): from two_factor.plugins.registry import registry if self.__deny_sms_method(): return registry.get_method("generator") return super().get_method()
But it would be a lot cleaner if SetupView had get_methods method. And i can just override it and do any filtering i want.
get_methods
What do you think? maybe there other ideas?
I can make PR if this is welcome change.
That sounds reasonable, feel free to make a PR :+1:
Please, take a look!
Hello.
We want to disable using SMS methods for admin users, but allow it for normal users.
Right now we're using overriden
SetupView
, with following code:But it would be a lot cleaner if
SetupView
hadget_methods
method. And i can just override it and do any filtering i want.What do you think? maybe there other ideas?
I can make PR if this is welcome change.