hook in registration view to set auth backend if required (#53757)

This commit is contained in:
Frédéric Péters 2021-05-11 17:17:20 +02:00
parent 245bac5829
commit fb05732164
1 changed files with 7 additions and 0 deletions

View File

@ -29,6 +29,13 @@ class AppConfig(django.apps.AppConfig):
user_logged_in.connect(signals.on_user_logged_in)
def a2_hook_event(self, name, **kwargs):
if name == 'registration':
logger = logging.getLogger(__name__)
if kwargs.get('authentication_method') == 'fedict':
user = kwargs.get('user')
user.backend = 'authentic2_auth_fedict.backends.FedictBackend'
default_app_config = 'authentic2_auth_fedict.AppConfig'