Source

django-publicauth / publicauth / views.py

Diff from to

File publicauth/views.py

     if request.method == "POST":
         form = str_to_class(settings.EXTRA_FORM)(request.POST)
         if form.is_valid():
-            user = form.save(identity, provider)
+            user = form.save(request, identity, provider)
             del request.session['identity']
-            user = auth.authenticate(identity=identity, provider=provider)
-            if user:
-                auth.login(request, user)
-                next_url = request.session['next_url']
-                del request.session['next_url']
-                return redirect(next_url)
+            if not settings.PUBLICAUTH_ACTIVATION_REQUIRED:
+                user = auth.authenticate(identity=identity, provider=provider)
+                if user:
+                    auth.login(request, user)
+                    next_url = request.session['next_url']
+                    del request.session['next_url']
+                    return redirect(next_url)
+            else:
+                messages.warning(request, lang.ACTIVATION_REQUIRED_TEXT)
+                return redirect(settings.ACTIVATION_REDIRECT_URL)
     else:
         initial = request.session['extra']
         form = str_to_class(settings.EXTRA_FORM)(initial=initial)