You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2019/08/30 13:14:11 UTC
[airavata-django-portal] branch master updated: Fix error that
occurs when an exception occurs during processing user login
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git
The following commit(s) were added to refs/heads/master by this push:
new b3b7e49 Fix error that occurs when an exception occurs during processing user login
b3b7e49 is described below
commit b3b7e49024ed47fa92da1bbc3a2302fc3fe1cb2d
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Thu Aug 29 17:26:51 2019 -0400
Fix error that occurs when an exception occurs during processing user login
---
django_airavata/apps/auth/views.py | 1 +
django_airavata/context_processors.py | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/django_airavata/apps/auth/views.py b/django_airavata/apps/auth/views.py
index ac67257..681138e 100644
--- a/django_airavata/apps/auth/views.py
+++ b/django_airavata/apps/auth/views.py
@@ -83,6 +83,7 @@ def handle_login(request):
else:
messages.error(request, "Login failed. Please try again.")
except Exception as err:
+ logger.exception("Login failed for user {}".format(username))
messages.error(request,
"Login failed: {}. Please try again.".format(str(err)))
return render(request, template, {
diff --git a/django_airavata/context_processors.py b/django_airavata/context_processors.py
index 889272e..e98666f 100644
--- a/django_airavata/context_processors.py
+++ b/django_airavata/context_processors.py
@@ -70,7 +70,8 @@ def user_session_data(request):
data["airavataInternalUserId"] = (request.user.username +
"@" +
settings.GATEWAY_ID)
- data["isGatewayAdmin"] = request.is_gateway_admin
+ # is_gateway_admin may not be set if a failure occurs during login
+ data["isGatewayAdmin"] = getattr(request, "is_gateway_admin", False)
return {
"user_session_data": json.dumps(data)
}