mirror of
https://git.linux-kernel.at/oliver/ivatar.git
synced 2025-11-17 05:28:03 +00:00
Merge branch 'master' into devel
This commit is contained in:
@@ -6,6 +6,7 @@ Test our views in ivatar.ivataraccount.views and ivatar.views
|
||||
import os
|
||||
import json
|
||||
import django
|
||||
from django.urls import reverse
|
||||
from django.test import TestCase
|
||||
from django.test import Client
|
||||
from django.contrib.auth.models import User
|
||||
@@ -76,3 +77,15 @@ class Tester(TestCase): # pylint: disable=too-many-public-methods
|
||||
j["unconfirmed_openids"], 0, "unconfirmed openids count incorrect"
|
||||
)
|
||||
self.assertEqual(j["avatars"], 0, "avatars count incorrect")
|
||||
|
||||
def test_logout(self):
|
||||
"""
|
||||
Test if logout works correctly
|
||||
"""
|
||||
self.login()
|
||||
response = self.client.get(reverse("logout"), follow=True)
|
||||
self.assertEqual(
|
||||
response.status_code, 405, "logout with get should lead to http error 405"
|
||||
)
|
||||
response = self.client.post(reverse("logout"), follow=True)
|
||||
self.assertEqual(response.status_code, 200, "logout with post should logout")
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<li><a href="{% url 'export' %}"><i class="fa fa-fw fa-file-archive-o" aria-hidden="true"></i> {% trans 'Download your libravatar data' %}</a></li>
|
||||
<li><a href="{% url 'password_change' %}"><i class="fa fa-fw fa-key" aria-hidden="true"></i> {% trans 'Change password' %}</a></li>
|
||||
<li><a href="{% url 'password_reset' %}"><i class="fa fa-fw fa-unlock-alt" aria-hidden="true"></i> {% trans 'Reset password' %}</a></li>
|
||||
<li><a href="{% url 'logout' %}"><i class="fa fa-fw fa-sign-out" aria-hidden="true"></i> {% trans 'Logout' %}</a></li>
|
||||
<li>{% include '_account_logout.html' %}</li>
|
||||
{% else %}
|
||||
<li><a href="{% url 'login' %}"><i class="fa fa-fw fa-sign-in" aria-hidden="true"></i> {% trans 'Local' %}</a></li>
|
||||
<li><a href="{% url 'new_account' %}"><i class="fa fa-fw fa-user-plus" aria-hidden="true"></i> {% trans 'Create account' %}</a></li>
|
||||
|
||||
6
templates/_account_logout.html
Normal file
6
templates/_account_logout.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{% load i18n %}
|
||||
<form id="logoutform" method="POST" action="{% url 'logout' %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden"/>
|
||||
</form>
|
||||
<a href="#" onClick="document.getElementById('logoutform').submit()"><i class="fa fa-fw fa-sign-out" aria-hidden="true"></i> {% trans 'Logout' %}</a>
|
||||
@@ -28,7 +28,7 @@
|
||||
<li><a href="{% url 'upload_export' %}"><i class="fa fa-fw fa-file-archive-o" aria-hidden="true"></i> {% trans 'Import libravatar XML export' %}</a></li>
|
||||
<li><a href="{% url 'password_change' %}"><i class="fa fa-fw fa-key" aria-hidden="true"></i> {% trans 'Change password' %}</a></li>
|
||||
<li><a href="{% url 'password_reset' %}"><i class="fa fa-fw fa-unlock-alt" aria-hidden="true"></i> {% trans 'Reset password' %}</a></li>
|
||||
<li><a href="{% url 'logout' %}"><i class="fa fa-fw fa-sign-out" aria-hidden="true"></i> {% trans 'Logout' %}</a></li>
|
||||
<li>{% include '_account_logout.html' %}</li>
|
||||
{% if user.is_staff %}
|
||||
<li>
|
||||
<a href="{% url 'admin:index' %}" target="_new"><i class="fa fa-fw fa-user-secret" aria-hidden="true"></i> {% trans 'Admin' %}</a>
|
||||
|
||||
Reference in New Issue
Block a user