Browse Source

fix(gui-v2): sign out after reset pwd like v1

pull/3110/head
Wing-Kam Wong 2 years ago
parent
commit
d2a5a81353
  1. 11
      packages/nc-gui-v2/pages/index/user/index/index.vue

11
packages/nc-gui-v2/pages/index/user/index/index.vue

@ -1,8 +1,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
import { navigateTo } from '#app'
import { extractSdkResponseErrorMsg } from '~/utils' import { extractSdkResponseErrorMsg } from '~/utils'
import { reactive, ref, useApi } from '#imports' import { reactive, ref, useApi, useGlobal } from '#imports'
import MaterialSymbolsWarning from '~icons/material-symbols/warning' import MaterialSymbolsWarning from '~icons/material-symbols/warning'
import MdiKeyChange from '~icons/mdi/key-change' import MdiKeyChange from '~icons/mdi/key-change'
@ -10,6 +11,8 @@ const { api } = useApi()
const { t } = useI18n() const { t } = useI18n()
const { signOut } = useGlobal()
const formValidator = ref() const formValidator = ref()
let error = $ref<string | null>(null) let error = $ref<string | null>(null)
@ -51,11 +54,13 @@ const passwordChange = async () => {
error = null error = null
try { try {
const { msg } = await api.auth.passwordChange({ await api.auth.passwordChange({
currentPassword: form.currentPassword, currentPassword: form.currentPassword,
newPassword: form.password, newPassword: form.password,
}) })
message.success(msg) message.success('Password changed successfully. Please login again.')
signOut()
navigateTo('/signin')
} catch (e: any) { } catch (e: any) {
error = await extractSdkResponseErrorMsg(e) error = await extractSdkResponseErrorMsg(e)
} }

Loading…
Cancel
Save