login works again
This commit is contained in:
parent
ebe487c5d8
commit
83a419caf7
3 changed files with 10 additions and 14 deletions
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue