Skip to content

Commit

Permalink
add audit log for login (#1488)
Browse files Browse the repository at this point in the history
  • Loading branch information
rstijerina authored Nov 14, 2024
1 parent 4f2fa08 commit 20123c8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions designsafe/apps/auth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from django.http import HttpResponseRedirect, HttpResponseBadRequest
from django.shortcuts import render
from designsafe.apps.api.users.tasks import cache_allocations
from designsafe.apps.api.utils import get_client_ip
from designsafe.apps.auth.tasks import new_user_alert
from designsafe.apps.onboarding.execute import execute_setup_steps, new_user_setup_check
from .models import TapisOAuthToken
Expand Down Expand Up @@ -138,6 +139,18 @@ def tapis_oauth_callback(request):

login(request, user)
launch_setup_checks(user)

METRICS.info(
"Auth",
extra={
"user": user.username,
"sessionId": getattr(request.session, "session_key", ""),
"operation": "LOGIN",
"agent": request.META.get("HTTP_USER_AGENT"),
"ip": get_client_ip(request),
"info": {},
},
)
else:
messages.error(
request,
Expand Down

0 comments on commit 20123c8

Please sign in to comment.