mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-27 17:35:07 +01:00
Add phone number verification and remove telemetry update call from place where authentication middleware isn't yet installed (in the middleware itself).
This commit is contained in:
parent
78630603f4
commit
ceb29eae74
2 changed files with 6 additions and 7 deletions
|
@ -168,12 +168,6 @@ class UserAuthenticationBackend(AuthenticationBackend):
|
||||||
if create_if_not_exists:
|
if create_if_not_exists:
|
||||||
user, is_new = await aget_or_create_user_by_phone_number(phone_number)
|
user, is_new = await aget_or_create_user_by_phone_number(phone_number)
|
||||||
if user and is_new:
|
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}")
|
logger.log(logging.INFO, f"🥳 New User Created: {user.uuid}")
|
||||||
else:
|
else:
|
||||||
user = await aget_user_by_phone_number(phone_number)
|
user = await aget_user_by_phone_number(phone_number)
|
||||||
|
|
|
@ -78,7 +78,12 @@ class KhojUserAdmin(UserAdmin):
|
||||||
search_fields = ("email", "username", "phone_number", "uuid")
|
search_fields = ("email", "username", "phone_number", "uuid")
|
||||||
filter_horizontal = ("groups", "user_permissions")
|
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"]
|
actions = ["get_email_login_url"]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue