From 23ea7513413aac747a6c44023718c78e1936779e Mon Sep 17 00:00:00 2001 From: silverpill Date: Tue, 18 Apr 2023 21:48:13 +0000 Subject: [PATCH] Send preferred authentication method along with user data when creating new account --- CHANGELOG.md | 4 ++++ src/api/users.ts | 10 ++++++++-- src/views/LandingPage.vue | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d26aa69..49e92fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Content warnings. - List enabled authentication methods in "Settings". +### Changed + +- Send preferred authentication method along with user data when creating new account. + ### Fixed - Fix update of unread notification counter. diff --git a/src/api/users.ts b/src/api/users.ts index 18fe859..4df43d0 100644 --- a/src/api/users.ts +++ b/src/api/users.ts @@ -145,11 +145,17 @@ interface UserCreateForm { invite_code: string | null; } -export async function createUser(userData: UserCreateForm): Promise { +export async function createUser( + loginType: "password" | "eip4361", + userData: UserCreateForm, +): Promise { const url = `${BACKEND_URL}/api/v1/accounts` const response = await http(url, { method: "POST", - json: userData, + json: { + authentication_method: loginType, + ...userData, + }, }) const data = await response.json() if (response.status !== 201) { diff --git a/src/views/LandingPage.vue b/src/views/LandingPage.vue index 7e9394c..8d37230 100644 --- a/src/views/LandingPage.vue +++ b/src/views/LandingPage.vue @@ -217,7 +217,7 @@ async function register() { let user let authToken try { - user = await createUser(userData) + user = await createUser(loginType, userData) authToken = await getAccessToken(loginType, loginData) } catch (error: any) { isLoading = false