diff --git a/src/components/login/NewPasswordForm.vue b/src/components/login/NewPasswordForm.vue index 7798ca7..3d7c62c 100644 --- a/src/components/login/NewPasswordForm.vue +++ b/src/components/login/NewPasswordForm.vue @@ -60,18 +60,17 @@ async function newPasswordFunc() { return } - /** - * @TODO: #238, this wont work if we redirect to the login page - * Find a way to just "close" this screen instead of redirecting - */ gameStore.addNotification({ title: 'Success', message: 'Password changed successfully' }) - window.location.href = '/' + + window.history.replaceState(null, '', window.location.pathname) + emit('switchToLogin') } function cancelNewPassword() { - window.location.href = '/' + window.history.replaceState(null, '', windowlocation.pathname) + emit('switchToLogin') } diff --git a/src/components/screens/Login.vue b/src/components/screens/Login.vue index a5c71bc..7180776 100644 --- a/src/components/screens/Login.vue +++ b/src/components/screens/Login.vue @@ -15,10 +15,10 @@ - + - + @@ -35,11 +35,16 @@ import NewPasswordForm from '@/components/login/NewPasswordForm.vue' import ResetPassword from '@/components/login/ResetPasswordModal.vue' const isPasswordResetFormShown = ref(false) -const doesUrlHaveToken = window.location.hash.includes('#') +const doesUrlHaveToken = ref(window.location.hash !== '') const gameStore = useGameStore() const currentForm = ref('login') +function switchToLogin() { + currentForm.value = 'login' + doesUrlHaveToken.value = false +} + // automatic login because of development onMounted(async () => { const token = useCookies().get('token')