Commits

Esteban Feldman committed 055b388

Now the validation view returns a page with the user in context
Minor fix in the ajax success return

  • Participants
  • Parent commits 1568001

Comments (0)

Files changed (1)

File registration/views.py

     """
     backend = get_backend(backend)
     account = backend.activate(request, **kwargs)
-
-    if account:
-        if success_url is None:
-            to, args, kwargs = backend.post_activation_redirect(request, account)
-            return redirect(to, *args, **kwargs)
-        else:
-            return redirect(success_url)
+    if account and success_url is not None:
+        # if success_url is None:
+        #     to, args, kwargs = backend.post_activation_redirect(request, account)
+        #     return redirect(to, *args, **kwargs)
+        # else:
+        return redirect(success_url)
 
     if extra_context is None:
         extra_context = {}
+    
+    # add the account to context    
+    extra_context.update({'account': account})
+    
     context = RequestContext(request)
     for key, value in extra_context.items():
         context[key] = callable(value) and value() or value
                 # see to add message dynamically
                 res.update({'status': 'OK', 'redirect': success_url, 'message': 'Hare Krishna'})
                 json = simplejson.dumps(res, cls=DjangoJSONEncoder)
-                print json
-                return HttpResponse(json)
+                return HttpResponse(json, mimetype='application/javascript')
         else:
             if is_ajax_request:
                 # import ipdb;ipdb.set_trace()