feat: added tracking events for password reset initiation
This commit is contained in:
committed by
Fatima Sohail
parent
bcf8b38c25
commit
8e7a5f18c7
@@ -16,6 +16,7 @@ from django.urls import reverse
|
||||
from django.utils.http import int_to_base36
|
||||
from edx_ace import ace
|
||||
from edx_ace.recipient import Recipient
|
||||
from eventtracking import tracker
|
||||
|
||||
from common.djangoapps.student.models import AccountRecoveryConfiguration
|
||||
from openedx.core.djangoapps.user_authn.toggles import should_redirect_to_authn_microfrontend
|
||||
@@ -27,6 +28,7 @@ from openedx.core.djangoapps.user_authn.message_types import PasswordReset
|
||||
from openedx.core.lib.celery.task_utils import emulate_http_request
|
||||
|
||||
logger = logging.getLogger(__name__) # pylint: disable=invalid-name
|
||||
PASSWORD_RESET_INITIATED = 'edx.user.passwordreset.initiated'
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
@@ -84,6 +86,15 @@ class Command(BaseCommand):
|
||||
user = get_user_model().objects.get(Q(username__iexact=username) | Q(email__iexact=current_email))
|
||||
user.email = desired_email
|
||||
user.save()
|
||||
tracker.emit(
|
||||
PASSWORD_RESET_INITIATED,
|
||||
{
|
||||
"email": user.email,
|
||||
"user_id": user.id,
|
||||
"old_email": current_email,
|
||||
"source": "Account Recovery Management Command",
|
||||
}
|
||||
)
|
||||
self.send_password_reset_email(user, site)
|
||||
successful_updates.append(desired_email)
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
|
||||
Reference in New Issue
Block a user