Browse Source

include hidden auth forms in document

Rafał Pitoń 10 years ago
parent
commit
b0a057d3ce
2 changed files with 25 additions and 0 deletions
  1. 11 0
      misago/emberapp/app/index.html
  2. 14 0
      misago/templates/misago/auth.html

+ 11 - 0
misago/emberapp/app/index.html

@@ -19,6 +19,17 @@
 
     <section id="main"></section>
 
+    <form id='hidden-login-form' method="post" action="/login/" style="display: none;">
+      <input name="csrfmiddlewaretoken" type="text" value="">
+      <input name="username" type="text">
+      <input name="password" type="password">
+      <input type="submit" id="signin-button" value="Sign in">
+    </form>
+    <form id='hidden-logout-form' method="post" action="/logout/" style="display: none;">
+      <input name="csrfmiddlewaretoken" type="text" value="">
+      <input type="submit" id="signin-button" value="Log out">
+    </form>
+
     <script src="http://localhost:8000/django-i18n.js"></script>
     <script src="http://localhost:8000/misago-preload-data.js"></script>
 

+ 14 - 0
misago/templates/misago/auth.html

@@ -0,0 +1,14 @@
+{% load i18n %}
+{% if user.is_authenticated %}
+<form id='hidden-login-form' method="post" action="{% url LOGIN_URL %}" style="display: none;">
+  {% csrf_token %}
+  <input name="username" type="text">
+  <input name="password" type="password">
+  <input type="submit" id="signin-button" value="{% trans "Sign in" %}">
+</form>
+{% else %}
+<form id='hidden-logout-form' method="post" action="{% url LOGOUT_URL %}" style="display: none;">
+  {% csrf_token %}
+  <input type="submit" id="signin-button" value="{% trans "Log out" %}">
+</form>
+{% endif %}