Fixing validation always being thrown on first visit.
authordwickwire <wickwire@gmail.com>
Wed, 18 Jan 2012 21:18:02 +0000 (15:18 -0600)
committerdwickwire <wickwire@gmail.com>
Wed, 18 Jan 2012 21:18:02 +0000 (15:18 -0600)
-- still need to hide errors for hidden fields

cas_provider/views.py

index ba7b0a2..5d9ea38 100644 (file)
@@ -73,11 +73,13 @@ def login(request, template_name='cas/login.html', success_redirect='/account/',
                     errors.append('This account is disabled.')
             else:
                     errors.append('Incorrect username and/or password.')
                     errors.append('This account is disabled.')
             else:
                     errors.append('Incorrect username and/or password.')
-    else:
         if merge:
             form = MergeLoginForm(request.GET, request=request)
         else:
             form = LoginForm(request.GET, request=request)
         if merge:
             form = MergeLoginForm(request.GET, request=request)
         else:
             form = LoginForm(request.GET, request=request)
+    else:
+      form = LoginForm(service)
+
     return render_to_response(template_name, {'form': form, 'errors': errors}, context_instance=RequestContext(request))
 
 def socialauth_login(request, template_name='cas/login.html', success_redirect='/account/'):
     return render_to_response(template_name, {'form': form, 'errors': errors}, context_instance=RequestContext(request))
 
 def socialauth_login(request, template_name='cas/login.html', success_redirect='/account/'):