Commits

Matthew Marshall  committed c866f30

tweaked form a little.

  • Participants
  • Parent commits 98330b1

Comments (0)

Files changed (2)

File repos/views.py

         repo_form.user = request.user
         new_account_form = login_form = None
     else:
-        if 'newaccount' in request.POST:
+        post_names = set(n for n,v in request.POST.items() if v)
+        print post_names
+        if post_names.intersection(('newaccount', 'new-username',
+                    'new-password1', 'new-password2')):
             new_account_form = NewAccountForm(request.POST, prefix='new')
             if new_account_form.is_valid():
                 user = User.objects.create_user(
                 repo_form.user = user
         else:
             new_account_form = NewAccountForm(prefix='new')
-        if 'login' in request.POST:
+        if post_names.intersection(('username', 'password')):
             login_form = LoginForm(request.POST)
             if login_form.is_valid():
                 user = login_form.user

File templates/frontpage.html

 {% extends "base.html" %}
 
-{% block title %}Easy Mercurial Hosting{% endblock %}
+{% block title %}Mercurial Hosting{% endblock %}
 
 {% block content %}
 
     <input type='submit' name='createrepo' value='Create repository for {{user.username}}' />
 {% else %}
     <div style="width:49%;float:left;">
+    <fieldset>
+    <table>{{ login_form }}</table>
+    <input type='submit' name='login' value='Login' />
+    </fieldset>
+    </div>
+
+    <div style="width:49%;float:right;">
+    <fieldset>
     <table>
     {{ new_account_form }}
     </table>
     <input type='submit' name='newaccount'  value='Create new account' />
-    </div>
-
-    <div style="width:49%;float:right;">
-    <table>{{ login_form }}</table>
-    <input type='submit' name='login' value='Login' />
+    </fieldset>
     </div>
 {% endif %}
 </form>