summaryrefslogtreecommitdiff
path: root/yaksh/middleware/user_time_zone.py
diff options
context:
space:
mode:
authorprathamesh2016-07-08 10:45:38 +0530
committerprathamesh2016-07-09 00:12:17 +0530
commit19f4c7b95bf32d0cf581274d947bdc9120c2e8f2 (patch)
treecc1efef7893be898e7e675a6073ba1e015b3b12c /yaksh/middleware/user_time_zone.py
parent41b4b7607d8ea6856a8b397d4c9e5bb9edea0b77 (diff)
downloadonline_test-19f4c7b95bf32d0cf581274d947bdc9120c2e8f2.tar.gz
online_test-19f4c7b95bf32d0cf581274d947bdc9120c2e8f2.tar.bz2
online_test-19f4c7b95bf32d0cf581274d947bdc9120c2e8f2.zip
oauth implemented
User can login via google and facebook. If user logs in from google and then later the same user logs in from facebook, then he will be considered as the same user if the email registered on facebook is of gmail. User profile will be created when user logs in via facebook or google. In yaksh pipeline, user.py is used to create profile. Pipeline settings is defined that defines the functions to be executed during oauth. Used bootstrap social and Font Awesome for UI design
Diffstat (limited to 'yaksh/middleware/user_time_zone.py')
-rw-r--r--yaksh/middleware/user_time_zone.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/yaksh/middleware/user_time_zone.py b/yaksh/middleware/user_time_zone.py
index f1aace9..0bd4831 100644
--- a/yaksh/middleware/user_time_zone.py
+++ b/yaksh/middleware/user_time_zone.py
@@ -8,8 +8,8 @@ class TimezoneMiddleware(object):
if user timezone is not available default value 'UTC' is activated """
def process_request(self, request):
user = request.user
+ user_tz = 'UTC'
if hasattr(user, 'profile'):
- user_tz = user.profile.timezone
- timezone.activate(pytz.timezone(user_tz))
- else:
- timezone.activate(pytz.timezone('UTC'))
+ if user.profile.timezone:
+ user_tz = user.profile.timezone
+ timezone.activate(pytz.timezone(user_tz))