Merge pull request #29522 from edx/add-prop-to-mark-users

refactor: add a property to distinguish old and new users
This commit is contained in:
Uzair Rasheed
2021-12-08 01:42:29 +05:00
committed by GitHub
2 changed files with 3 additions and 2 deletions

View File

@@ -24,7 +24,7 @@ log = logging.getLogger('edx.celery.task')
@shared_task
@set_code_owner_attribute
def check_pwned_password_and_send_track_event(user_id, password, internal_user=False):
def check_pwned_password_and_send_track_event(user_id, password, internal_user=False, is_new_user=False):
"""
Check the Pwned Databases and send its event to Segment.
"""
@@ -32,6 +32,7 @@ def check_pwned_password_and_send_track_event(user_id, password, internal_user=F
pwned_properties = check_pwned_password(password)
if pwned_properties:
pwned_properties['internal_user'] = internal_user
pwned_properties['new_user'] = is_new_user
segment.track(user_id, 'edx.bi.user.pwned.password.status', pwned_properties)
except Exception: # pylint: disable=W0703
log.exception(

View File

@@ -292,7 +292,7 @@ def create_account_with_params(request, params): # pylint: disable=too-many-sta
def is_new_user(password, user):
if user is not None:
AUDIT_LOG.info(f"Login success on new account creation - {user.username}")
check_pwned_password_and_send_track_event.delay(user.id, password, user.is_staff)
check_pwned_password_and_send_track_event.delay(user.id, password, user.is_staff, True)
def _link_user_to_third_party_provider(