##// END OF EJS Templates
audit-logs: store user agent for login/logout actions.
marcink -
r1702:d464b1a6 default
parent child Browse files
Show More
@@ -171,8 +171,10 b' class LoginView(BaseAppView):'
171 171 audit_user = audit_logger.UserWrap(
172 172 username=self.request.params.get('username'),
173 173 ip_addr=self.request.remote_addr)
174 audit_logger.store(action='user.login.success', user=audit_user,
175 commit=True)
174 action_data = {'user_agent': self.request.user_agent}
175 audit_logger.store(
176 action='user.login.success', action_data=action_data,
177 user=audit_user, commit=True)
176 178
177 179 raise HTTPFound(c.came_from, headers=headers)
178 180 except formencode.Invalid as errors:
@@ -188,8 +190,10 b' class LoginView(BaseAppView):'
188 190 audit_user = audit_logger.UserWrap(
189 191 username=self.request.params.get('username'),
190 192 ip_addr=self.request.remote_addr)
191 audit_logger.store(action='user.login.failure', user=audit_user,
192 commit=True)
193 action_data = {'user_agent': self.request.user_agent}
194 audit_logger.store(
195 action='user.login.failure', action_data=action_data,
196 user=audit_user, commit=True)
193 197 return render_ctx
194 198
195 199 except UserCreationError as e:
@@ -205,8 +209,11 b' class LoginView(BaseAppView):'
205 209 def logout(self):
206 210 auth_user = self._rhodecode_user
207 211 log.info('Deleting session for user: `%s`', auth_user)
208 audit_logger.store(action='user.logout', user=auth_user,
209 commit=True)
212
213 action_data = {'user_agent': self.request.user_agent}
214 audit_logger.store(
215 action='user.logout', action_data=action_data,
216 user=auth_user, commit=True)
210 217 self.session.delete()
211 218 return HTTPFound(url('home'))
212 219
@@ -355,8 +362,10 b' class LoginView(BaseAppView):'
355 362 # Display success message and redirect.
356 363 self.session.flash(msg, queue='success')
357 364
365 action_data = {'email': user_email,
366 'user_agent': self.request.user_agent}
358 367 audit_logger.store(action='user.password.reset_request',
359 action_data={'email': user_email},
368 action_data=action_data,
360 369 user=self._rhodecode_user, commit=True)
361 370 return HTTPFound(self.request.route_path('reset_password'))
362 371
General Comments 0
You need to be logged in to leave comments. Login now