Show More
@@ -41,7 +41,7 class AuthUser(object): | |||
|
41 | 41 | """ |
|
42 | 42 | A simple object that handles a mercurial username for authentication |
|
43 | 43 | """ |
|
44 |
username = ' |
|
|
44 | username = 'None' | |
|
45 | 45 | is_authenticated = False |
|
46 | 46 | is_admin = False |
|
47 | 47 | permissions = set() |
@@ -61,16 +61,17 class LoginRequired(object): | |||
|
61 | 61 | pass |
|
62 | 62 | |
|
63 | 63 | def __call__(self, func): |
|
64 | user = session.get('hg_app_user', AuthUser()) | |
|
65 | log.info('Checking login required for %s', user.username) | |
|
66 | 64 | |
|
67 | 65 | @wraps(func) |
|
68 | 66 | def _wrapper(*fargs, **fkwargs): |
|
67 | user = session.get('hg_app_user', AuthUser()) | |
|
68 | log.info('Checking login required for user:%s', user.username) | |
|
69 | 69 | if user.is_authenticated: |
|
70 | 70 | log.info('user %s is authenticated', user.username) |
|
71 | 71 | func(*fargs) |
|
72 | 72 | else: |
|
73 | 73 | logging.info('user %s not authenticated', user.username) |
|
74 | logging.info('redirecting to login page') | |
|
74 | 75 | return redirect(url('login_home')) |
|
75 | 76 | |
|
76 | 77 | return _wrapper |
General Comments 0
You need to be logged in to leave comments.
Login now