Skip to content

Commit 543265c

Browse files
Kinplemelonysfscream
authored andcommitted
refactor(user): update API for resetting user TOTP secret
1 parent 623e5d8 commit 543265c

2 files changed

Lines changed: 2 additions & 6 deletions

File tree

src/api/function.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function destroyUser(username: string, backend?: string): Promise<void> {
3838
export function updateUserMfa(
3939
username: string,
4040
body: { mechanism: string },
41-
query: { backend?: string },
41+
query?: { backend?: string },
4242
): Promise<void> {
4343
return http.post(
4444
`/users/${encodeURIComponent(username)}/mfa`,

src/views/General/components/UserMFASettingDialog.vue

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,7 @@ const resetTOTPSecret = async () => {
8585
return
8686
}
8787
submitLoading.value = true
88-
if (isSSOUser.value) {
89-
await deleteUserMfa(username, { reset: true, backend })
90-
} else {
91-
await updateUserMfa(username, { mechanism: UserMFA.totp })
92-
}
88+
await updateUserMfa(username, { mechanism: UserMFA.totp }, backend ? { backend } : undefined)
9389
ElMessage.success(t('Base.resetSuccess'))
9490
emit('submitted')
9591
showDialog.value = false

0 commit comments

Comments
 (0)