Browse Source

Signin form

Rafał Pitoń 11 years ago
parent
commit
284eab9887
3 changed files with 60 additions and 4 deletions
  1. 48 1
      misago/templates/misago/login.html
  2. 10 1
      misago/users/views/auth.py
  3. 2 2
      uiframework/form.html

+ 48 - 1
misago/templates/misago/login.html

@@ -8,6 +8,53 @@
 
 {% block content %}
 <div class="container">
-  Hello world, I'm placeholder signin page!
+
+  <div class="row">
+    <div class="col-md-4 col-md-offset-4">
+
+      <div class="form-panel">
+        <form method="POST" role="form">
+          {% csrf_token %}
+
+          <div class="form-header">
+            <h1>{% trans "Sign in" %}</h1>
+          </div>
+
+          <div class="form-body no-fieldsets">
+
+            <div class="form-group">
+              <label for="inputEmail3" class="control-label">Email</label>
+              <div class="control-input">
+                <input type="email" class="form-control" id="inputEmail3" placeholder="Email">
+              </div>
+            </div>
+            <div class="form-group">
+              <label for="inputPassword3" class="control-label">Password</label>
+              <div class="control-input">
+                <input type="password" class="form-control" id="inputPassword3" placeholder="Password">
+              </div>
+            </div>
+
+          </div>
+
+          <div class="form-footer">
+            <button class="btn btn-primary">{% trans "Sign in" %}</button>
+
+            <div class="extra">
+              <h4>Need help?</h4>
+              <ul class="list-unstyled">
+                <li><a href="#">I don't remember my password</a></li>
+                <li><a href="#">My account is inactive</a></li>
+                <li><a href="#">I don't have account</a></li>
+              </ul>
+            </div>
+          </div>
+
+        </form>
+      </div>
+
+    </div>
+  </div>
+
 </div>
 {% endblock content %}

+ 10 - 1
misago/users/views/auth.py

@@ -1,9 +1,11 @@
+from django.contrib.auth import authenticate, login
 from django.shortcuts import render, redirect
 from django.views.decorators.debug import sensitive_post_parameters
 from django.views.decorators.cache import never_cache
 from django.views.decorators.csrf import csrf_protect
 from misago.core.decorators import require_POST
 from misago.users.decorators import deny_authenticated, deny_guests
+from misago.users.forms.auth import AuthenticationForm
 
 
 @sensitive_post_parameters()
@@ -11,7 +13,14 @@ from misago.users.decorators import deny_authenticated, deny_guests
 @csrf_protect
 @never_cache
 def login(request):
-    return render(request, 'misago/login.html')
+    form = AuthenticationForm()
+
+    if request.method == 'POST':
+        form = AuthenticationForm(request.POST)
+        if form.is_valid():
+            pass
+
+    return render(request, 'misago/login.html', {'form': form})
 
 
 @deny_guests

+ 2 - 2
uiframework/form.html

@@ -174,9 +174,9 @@
             </div>
           </div>
 
-        </div>
+        </form>
+      </div>
 
-      </form>
     </div>
 
     <div class="container">