From 83a419caf75e3627cf1ee42b73426dab75f90b25 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 27 Jan 2026 21:55:36 +0200 Subject: [PATCH] login works again --- src/boot/after_store.js | 2 +- src/components/mfa_form/totp_form.js | 12 +++++------- src/stores/oauth.js | 10 ++++------ 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/boot/after_store.js b/src/boot/after_store.js index ed8fbb080..abc351549 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -472,7 +472,7 @@ const setConfig = async ({ store }) => { const checkOAuthToken = async ({ store }) => { const oauth = useOAuthStore() - if (oauth.getUserToken) { + if (oauth.userToken) { return store.dispatch('loginUser', oauth.getUserToken) } return Promise.resolve() diff --git a/src/components/mfa_form/totp_form.js b/src/components/mfa_form/totp_form.js index ab7754415..99ea2b85e 100644 --- a/src/components/mfa_form/totp_form.js +++ b/src/components/mfa_form/totp_form.js @@ -1,10 +1,10 @@ -import { mapActions, mapState as mapPiniaState, mapStores } from 'pinia' -import { mapState } from 'vuex' +import { mapActions, mapState, mapStores } from 'pinia' import mfaApi from '../../services/new_api/mfa.js' import { useAuthFlowStore } from 'src/stores/auth_flow.js' import { useOAuthStore } from 'src/stores/oauth.js' +import { useInstanceStore } from 'src/stores/instance.js' import { library } from '@fortawesome/fontawesome-svg-core' import { faTimes } from '@fortawesome/free-solid-svg-icons' @@ -17,13 +17,11 @@ export default { error: false, }), computed: { - ...mapPiniaState(useAuthFlowStore, { + ...mapState(useAuthFlowStore, { authSettings: (store) => store.settings, }), + ...mapState(useInstanceStore, ['server']), ...mapStores(useOAuthStore), - ...mapState({ - instance: 'instance', - }), }, methods: { ...mapActions(useAuthFlowStore, ['requireRecovery', 'abortMFA', 'login']), @@ -43,7 +41,7 @@ export default { const data = { clientId, clientSecret, - instance: this.instance.server, + instance: this.server, mfaToken: this.authSettings.mfa_token, code: this.code, } diff --git a/src/stores/oauth.js b/src/stores/oauth.js index ea5a4bfac..47eee00bc 100644 --- a/src/stores/oauth.js +++ b/src/stores/oauth.js @@ -1,4 +1,5 @@ import { defineStore } from 'pinia' +import { useInstanceStore } from 'src/stores/instance.js' import { createApp, @@ -42,9 +43,6 @@ export const useOAuthStore = defineStore('oauth', { getToken() { return this.userToken || this.appToken }, - getUserToken() { - return this.userToken - }, }, actions: { setClientData({ clientId, clientSecret }) { @@ -62,7 +60,7 @@ export const useOAuthStore = defineStore('oauth', { }, async createApp() { const { state } = window.vuex - const instance = state.instance.server + const instance = useInstanceStore().server const app = await createApp(instance) this.setClientData(app) return app @@ -82,7 +80,7 @@ export const useOAuthStore = defineStore('oauth', { }, async getAppToken() { const { state } = window.vuex - const instance = state.instance.server + const instance = useInstanceStore().server const res = await getClientToken({ clientId: this.clientId, clientSecret: this.clientSecret, @@ -98,7 +96,7 @@ export const useOAuthStore = defineStore('oauth', { if (this.appToken) { try { await verifyAppToken({ - instance: state.instance.server, + instance: useInstanceStore().server, appToken: this.appToken, }) return this.appToken