|
|
@ -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) |
|
|
|
} |
|
|
|
} |
|
|
|