Show More
@@ -55,7 +55,7 b' CaptchaData = collections.namedtuple(' | |||||
55 | 'CaptchaData', 'active, private_key, public_key') |
|
55 | 'CaptchaData', 'active, private_key, public_key') | |
56 |
|
56 | |||
57 |
|
57 | |||
58 |
def |
|
58 | def store_user_in_session(session, username, remember=False): | |
59 | user = User.get_by_username(username, case_insensitive=True) |
|
59 | user = User.get_by_username(username, case_insensitive=True) | |
60 | auth_user = AuthUser(user.user_id) |
|
60 | auth_user = AuthUser(user.user_id) | |
61 | auth_user.set_authenticated() |
|
61 | auth_user.set_authenticated() | |
@@ -165,7 +165,7 b' class LoginView(BaseAppView):' | |||||
165 | auth_info = authenticate( |
|
165 | auth_info = authenticate( | |
166 | '', '', self.request.environ, HTTP_TYPE, skip_missing=True) |
|
166 | '', '', self.request.environ, HTTP_TYPE, skip_missing=True) | |
167 | if auth_info: |
|
167 | if auth_info: | |
168 |
headers = |
|
168 | headers = store_user_in_session( | |
169 | self.session, auth_info.get('username')) |
|
169 | self.session, auth_info.get('username')) | |
170 | raise HTTPFound(c.came_from, headers=headers) |
|
170 | raise HTTPFound(c.came_from, headers=headers) | |
171 | except UserCreationError as e: |
|
171 | except UserCreationError as e: | |
@@ -186,7 +186,7 b' class LoginView(BaseAppView):' | |||||
186 | self.session.invalidate() |
|
186 | self.session.invalidate() | |
187 | form_result = login_form.to_python(self.request.POST) |
|
187 | form_result = login_form.to_python(self.request.POST) | |
188 | # form checks for username/password, now we're authenticated |
|
188 | # form checks for username/password, now we're authenticated | |
189 |
headers = |
|
189 | headers = store_user_in_session( | |
190 | self.session, |
|
190 | self.session, | |
191 | username=form_result['username'], |
|
191 | username=form_result['username'], | |
192 | remember=form_result['remember']) |
|
192 | remember=form_result['remember']) |
General Comments 0
You need to be logged in to leave comments.
Login now