From ceb29eae744f9ce483463fd3d6dacd418610475f Mon Sep 17 00:00:00 2001 From: sabaimran Date: Sat, 9 Nov 2024 12:25:36 -0800 Subject: [PATCH] Add phone number verification and remove telemetry update call from place where authentication middleware isn't yet installed (in the middleware itself). --- src/khoj/configure.py | 6 ------ src/khoj/database/admin.py | 7 ++++++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/khoj/configure.py b/src/khoj/configure.py index df0760fb..a1f4a7db 100644 --- a/src/khoj/configure.py +++ b/src/khoj/configure.py @@ -168,12 +168,6 @@ class UserAuthenticationBackend(AuthenticationBackend): if create_if_not_exists: user, is_new = await aget_or_create_user_by_phone_number(phone_number) if user and is_new: - update_telemetry_state( - request=request, - telemetry_type="api", - api="create_user", - metadata={"server_id": str(user.uuid)}, - ) logger.log(logging.INFO, f"🥳 New User Created: {user.uuid}") else: user = await aget_user_by_phone_number(phone_number) diff --git a/src/khoj/database/admin.py b/src/khoj/database/admin.py index b4059e8c..f7c140c1 100644 --- a/src/khoj/database/admin.py +++ b/src/khoj/database/admin.py @@ -78,7 +78,12 @@ class KhojUserAdmin(UserAdmin): search_fields = ("email", "username", "phone_number", "uuid") filter_horizontal = ("groups", "user_permissions") - fieldsets = (("Personal info", {"fields": ("phone_number", "email_verification_code")}),) + UserAdmin.fieldsets + fieldsets = ( + ( + "Personal info", + {"fields": ("phone_number", "email_verification_code", "verified_phone_number", "verified_email")}, + ), + ) + UserAdmin.fieldsets actions = ["get_email_login_url"]