Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Aug 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 8 additions & 3 deletions packages/nc-gui-v2/pages/index/user/index/index.vue
@@ -1,15 +1,18 @@
<script lang="ts" setup>
import { useI18n } from 'vue-i18n'
import { message } from 'ant-design-vue'
import { navigateTo } from '#app'
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 MdiKeyChange from '~icons/mdi/key-change'

const { api } = useApi()

const { t } = useI18n()

const { signOut } = useGlobal()

const formValidator = ref()
let error = $ref<string | null>(null)

Expand Down Expand Up @@ -51,11 +54,13 @@ const passwordChange = async () => {

error = null
try {
const { msg } = await api.auth.passwordChange({
await api.auth.passwordChange({
currentPassword: form.currentPassword,
newPassword: form.password,
})
message.success(msg)
message.success('Password changed successfully. Please login again.')
signOut()
navigateTo('/signin')
} catch (e: any) {
error = await extractSdkResponseErrorMsg(e)
}
Expand Down