Skip to content
Snippets Groups Projects
Commit 1dcdbaab authored by Christian Dresen's avatar Christian Dresen
Browse files

[WarpAuth] Enable error message if trying to log in with a deactivated account

parent 19a90d40
Branches master
No related tags found
No related merge requests found
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
<label for="inputPassword" style="padding-top:10px;">{% trans "Password" %}</label> <label for="inputPassword" style="padding-top:10px;">{% trans "Password" %}</label>
<input name="password" type="password" id="inputPassword" class="form-control" placeholder="{% trans "Password" %}" required> <input name="password" type="password" id="inputPassword" class="form-control" placeholder="{% trans "Password" %}" required>
{% if fail == True %} {% if error %}
<div class="alert alert-warning alert-dismissible" role="alert"> <div class="alert alert-warning alert-dismissible" role="alert">
<strong>{% trans "Invalid email or password." %}</strong> <strong>{{ error }}</strong>
</div> </div>
{% else %} {% else %}
<br> <br>
......
...@@ -5,6 +5,7 @@ from django.shortcuts import redirect ...@@ -5,6 +5,7 @@ from django.shortcuts import redirect
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.utils import translation from django.utils import translation
from warpauth.util import * from warpauth.util import *
from django.utils.translation import ugettext as _
def login_view(request): def login_view(request):
pages['page_title'] = "Login" pages['page_title'] = "Login"
...@@ -23,9 +24,11 @@ def login_view(request): ...@@ -23,9 +24,11 @@ def login_view(request):
translation.activate(user_language) translation.activate(user_language)
request.session[translation.LANGUAGE_SESSION_KEY] = user_language request.session[translation.LANGUAGE_SESSION_KEY] = user_language
return redirect('/') return redirect('/')
else:
pages['error'] = _("Your account is deactivated. Please contact an administrator.")
else: else:
if username != "" and password != "": if username != "" and password != "":
pages['fail'] = True pages['error'] = _("Invalid email or password.")
return HttpResponse(render(request, 'warpauth/login.html', pages)) return HttpResponse(render(request, 'warpauth/login.html', pages))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment