##// END OF EJS Templates
login: Move method to store user in session out of login controller....
johbo -
r28:48f65d03 default
parent child Browse files
Show More
@@ -52,12 +52,7 b' from rhodecode.model.user import UserMod'
52 52 log = logging.getLogger(__name__)
53 53
54 54
55 class LoginController(BaseController):
56
57 def __before__(self):
58 super(LoginController, self).__before__()
59
60 def _store_user_in_session(self, username, remember=False):
55 def _store_user_in_session(username, remember=False):
61 56 user = User.get_by_username(username, case_insensitive=True)
62 57 auth_user = AuthUser(user.user_id)
63 58 auth_user.set_authenticated()
@@ -86,6 +81,12 b' class LoginController(BaseController):'
86 81 headers = [('Set-Cookie', session.request['cookie_out'])]
87 82 return headers
88 83
84
85 class LoginController(BaseController):
86
87 def __before__(self):
88 super(LoginController, self).__before__()
89
89 90 def _validate_came_from(self, came_from):
90 91 if not came_from:
91 92 return came_from
@@ -134,7 +135,7 b' class LoginController(BaseController):'
134 135 session.invalidate()
135 136 c.form_result = login_form.to_python(dict(request.POST))
136 137 # form checks for username/password, now we're authenticated
137 headers = self._store_user_in_session(
138 headers = _store_user_in_session(
138 139 username=c.form_result['username'],
139 140 remember=c.form_result['remember'])
140 141 raise self._redirect_to_origin(
@@ -170,7 +171,7 b' class LoginController(BaseController):'
170 171 return render('/login.html')
171 172
172 173 if auth_info:
173 headers = self._store_user_in_session(auth_info.get('username'))
174 headers = _store_user_in_session(auth_info.get('username'))
174 175 raise self._redirect_to_origin(
175 176 location=c.came_from, headers=headers)
176 177 return render('/login.html')
General Comments 0
You need to be logged in to leave comments. Login now