Invert authentication test logic from is_anonymous to not is_authenticated
From: http://gdub.wordpress.com/2006/09/23/is_authenticated-vs-is_anonymous/
This commit is contained in:
@@ -3,51 +3,52 @@
|
||||
{% load theme_tags %}
|
||||
|
||||
{% block web_theme_head %}
|
||||
{% if not user.is_anonymous %}
|
||||
{% if user.is_authenticated %}
|
||||
{% get_login_redirect_url %}
|
||||
<meta http-equiv="REFRESH" content="5;url={{ LOGIN_REDIRECT_URL }}">
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block html_title %}{% trans "Login" %}{% endblock %}
|
||||
{% if not user.is_anonymous %}
|
||||
{% block web_theme_content %}
|
||||
{% get_login_redirect_url %}
|
||||
<div class="content">
|
||||
<h2 class="title">{% trans "You are already logged in" %}</h2>
|
||||
<div class="inner">
|
||||
<p>
|
||||
{% trans "Redirecting you to the website entry point in 5 seconds." %}
|
||||
<p>
|
||||
</p>
|
||||
{% blocktrans %}Or click <a href="{{ LOGIN_REDIRECT_URL }}">here</a> if redirection doesn't work.{% endblocktrans %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% else %}
|
||||
{% block content_plain %}
|
||||
<div id="box">
|
||||
<h1>{% block project_name %}{% endblock %}</h1>
|
||||
<div class="block" id="block-login">
|
||||
<h2>{% trans "Login" %}</h2>
|
||||
<div class="content login">
|
||||
<form action="." method="post" class="form login">{% csrf_token %}
|
||||
<div class="group wat-cf">
|
||||
{% include "generic_form_instance.html" %}
|
||||
<input type="hidden" name="next" value="{{ next|escape }}" />
|
||||
<div class="group navform wat-cf">
|
||||
<button class="button" type="submit">
|
||||
<img src="{{ STATIC_URL }}web_theme_media/images/icons/key.png" alt="Save" /> Login
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% if user.is_authenticated %}
|
||||
{% block web_theme_content %}
|
||||
{% get_login_redirect_url %}
|
||||
<div class="content">
|
||||
<h2 class="title">{% trans "You are already logged in" %}</h2>
|
||||
<div class="inner">
|
||||
<p>
|
||||
{% trans "Redirecting you to the website entry point in 5 seconds." %}
|
||||
<p>
|
||||
</p>
|
||||
{% blocktrans %}Or click <a href="{{ LOGIN_REDIRECT_URL }}">here</a> if redirection doesn't work.{% endblocktrans %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% get_web_theme_setting "VERBOSE_LOGIN" as verbose_login %}
|
||||
{% if verbose_login %}
|
||||
{% include "verbose_login.html" %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% else %}
|
||||
{% block content_plain %}
|
||||
<div id="box">
|
||||
<h1>{% block project_name %}{% endblock %}</h1>
|
||||
<div class="block" id="block-login">
|
||||
<h2>{% trans "Login" %}</h2>
|
||||
<div class="content login">
|
||||
<form action="." method="post" class="form login">{% csrf_token %}
|
||||
<div class="group wat-cf">
|
||||
{% include "generic_form_instance.html" %}
|
||||
<input type="hidden" name="next" value="{{ next|escape }}" />
|
||||
<div class="group navform wat-cf">
|
||||
<button class="button" type="submit">
|
||||
<img src="{{ STATIC_URL }}web_theme_media/images/icons/key.png" alt="Save" /> Login
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% get_web_theme_setting "VERBOSE_LOGIN" as verbose_login %}
|
||||
{% if verbose_login %}
|
||||
{% include "verbose_login.html" %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user