diff --git a/registration/signals.py b/registration/signals.py index 013fcd75..f7a31312 100644 --- a/registration/signals.py +++ b/registration/signals.py @@ -12,10 +12,11 @@ def login_user(sender, user, request, **kwargs): """ Automatically authenticate the user when activated """ - if getattr(settings, 'REGISTRATION_AUTO_LOGIN', False ): - backend = get_backends()[0] # Hack to bypass `authenticate()`. - user.backend = "%s.%s" % (backend.__module__, backend.__class__.__name__) - login(request, user) - request.session['REGISTRATION_AUTO_LOGIN'] = True - request.session.modified = True -user_activated.connect(login_user) \ No newline at end of file + backend = get_backends()[0] # Hack to bypass `authenticate()`. + user.backend = "%s.%s" % (backend.__module__, backend.__class__.__name__) + login(request, user) + request.session['REGISTRATION_AUTO_LOGIN'] = True + request.session.modified = True + +if getattr(settings, 'REGISTRATION_AUTO_LOGIN', False): + user_activated.connect(login_user) \ No newline at end of file