##// END OF EJS Templates
auth: Change login url generation in auth decorators....
johbo -
r35:3c60da43 default
parent child Browse files
Show More
@@ -1099,6 +1099,7 b' class LoginRequired(object):'
1099 1099 return get_cython_compat_decorator(self.__wrapper, func)
1100 1100
1101 1101 def __wrapper(self, func, *fargs, **fkwargs):
1102 from rhodecode.lib import helpers as h
1102 1103 cls = fargs[0]
1103 1104 user = cls._rhodecode_user
1104 1105 loc = "%s:%s" % (cls.__class__.__name__, func.__name__)
@@ -1106,7 +1107,6 b' class LoginRequired(object):'
1106 1107 # check if our IP is allowed
1107 1108 ip_access_valid = True
1108 1109 if not user.ip_allowed:
1109 from rhodecode.lib import helpers as h
1110 1110 h.flash(h.literal(_('IP %s not allowed' % (user.ip_addr,))),
1111 1111 category='warning')
1112 1112 ip_access_valid = False
@@ -1158,7 +1158,7 b' class LoginRequired(object):'
1158 1158
1159 1159 log.debug('redirecting to login page with %s' % (came_from,))
1160 1160 return redirect(
1161 url('login_home', came_from=came_from))
1161 h.route_path('login', _query={'came_from': came_from}))
1162 1162
1163 1163
1164 1164 class NotAnonymous(object):
@@ -1184,7 +1184,8 b' class NotAnonymous(object):'
1184 1184 h.flash(_('You need to be a registered user to '
1185 1185 'perform this action'),
1186 1186 category='warning')
1187 return redirect(url('login_home', came_from=came_from))
1187 return redirect(
1188 h.route_path('login', _query={'came_from': came_from}))
1188 1189 else:
1189 1190 return func(*fargs, **fkwargs)
1190 1191
@@ -1267,7 +1268,8 b' class PermsDecorator(object):'
1267 1268 import rhodecode.lib.helpers as h
1268 1269 h.flash(_('You need to be signed in to view this page'),
1269 1270 category='warning')
1270 return redirect(url('login_home', came_from=came_from))
1271 return redirect(
1272 h.route_path('login', _query={'came_from': came_from}))
1271 1273
1272 1274 else:
1273 1275 # redirect with forbidden ret code
General Comments 0
You need to be logged in to leave comments. Login now