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 checkOAuthToken = async ({ store }) => {
|
||||||
const oauth = useOAuthStore()
|
const oauth = useOAuthStore()
|
||||||
if (oauth.getUserToken) {
|
if (oauth.userToken) {
|
||||||
return store.dispatch('loginUser', oauth.getUserToken)
|
return store.dispatch('loginUser', oauth.getUserToken)
|
||||||
}
|
}
|
||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import { mapActions, mapState as mapPiniaState, mapStores } from 'pinia'
|
import { mapActions, mapState, mapStores } from 'pinia'
|
||||||
import { mapState } from 'vuex'
|
|
||||||
|
|
||||||
import mfaApi from '../../services/new_api/mfa.js'
|
import mfaApi from '../../services/new_api/mfa.js'
|
||||||
|
|
||||||
import { useAuthFlowStore } from 'src/stores/auth_flow.js'
|
import { useAuthFlowStore } from 'src/stores/auth_flow.js'
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
|
import { useInstanceStore } from 'src/stores/instance.js'
|
||||||
|
|
||||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
import { faTimes } from '@fortawesome/free-solid-svg-icons'
|
import { faTimes } from '@fortawesome/free-solid-svg-icons'
|
||||||
|
|
@ -17,13 +17,11 @@ export default {
|
||||||
error: false,
|
error: false,
|
||||||
}),
|
}),
|
||||||
computed: {
|
computed: {
|
||||||
...mapPiniaState(useAuthFlowStore, {
|
...mapState(useAuthFlowStore, {
|
||||||
authSettings: (store) => store.settings,
|
authSettings: (store) => store.settings,
|
||||||
}),
|
}),
|
||||||
|
...mapState(useInstanceStore, ['server']),
|
||||||
...mapStores(useOAuthStore),
|
...mapStores(useOAuthStore),
|
||||||
...mapState({
|
|
||||||
instance: 'instance',
|
|
||||||
}),
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(useAuthFlowStore, ['requireRecovery', 'abortMFA', 'login']),
|
...mapActions(useAuthFlowStore, ['requireRecovery', 'abortMFA', 'login']),
|
||||||
|
|
@ -43,7 +41,7 @@ export default {
|
||||||
const data = {
|
const data = {
|
||||||
clientId,
|
clientId,
|
||||||
clientSecret,
|
clientSecret,
|
||||||
instance: this.instance.server,
|
instance: this.server,
|
||||||
mfaToken: this.authSettings.mfa_token,
|
mfaToken: this.authSettings.mfa_token,
|
||||||
code: this.code,
|
code: this.code,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
|
import { useInstanceStore } from 'src/stores/instance.js'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
createApp,
|
createApp,
|
||||||
|
|
@ -42,9 +43,6 @@ export const useOAuthStore = defineStore('oauth', {
|
||||||
getToken() {
|
getToken() {
|
||||||
return this.userToken || this.appToken
|
return this.userToken || this.appToken
|
||||||
},
|
},
|
||||||
getUserToken() {
|
|
||||||
return this.userToken
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
setClientData({ clientId, clientSecret }) {
|
setClientData({ clientId, clientSecret }) {
|
||||||
|
|
@ -62,7 +60,7 @@ export const useOAuthStore = defineStore('oauth', {
|
||||||
},
|
},
|
||||||
async createApp() {
|
async createApp() {
|
||||||
const { state } = window.vuex
|
const { state } = window.vuex
|
||||||
const instance = state.instance.server
|
const instance = useInstanceStore().server
|
||||||
const app = await createApp(instance)
|
const app = await createApp(instance)
|
||||||
this.setClientData(app)
|
this.setClientData(app)
|
||||||
return app
|
return app
|
||||||
|
|
@ -82,7 +80,7 @@ export const useOAuthStore = defineStore('oauth', {
|
||||||
},
|
},
|
||||||
async getAppToken() {
|
async getAppToken() {
|
||||||
const { state } = window.vuex
|
const { state } = window.vuex
|
||||||
const instance = state.instance.server
|
const instance = useInstanceStore().server
|
||||||
const res = await getClientToken({
|
const res = await getClientToken({
|
||||||
clientId: this.clientId,
|
clientId: this.clientId,
|
||||||
clientSecret: this.clientSecret,
|
clientSecret: this.clientSecret,
|
||||||
|
|
@ -98,7 +96,7 @@ export const useOAuthStore = defineStore('oauth', {
|
||||||
if (this.appToken) {
|
if (this.appToken) {
|
||||||
try {
|
try {
|
||||||
await verifyAppToken({
|
await verifyAppToken({
|
||||||
instance: state.instance.server,
|
instance: useInstanceStore().server,
|
||||||
appToken: this.appToken,
|
appToken: this.appToken,
|
||||||
})
|
})
|
||||||
return this.appToken
|
return this.appToken
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue