You've already forked AstralRinth
forked from didirus/AstralRinth
Fix auth again
This commit is contained in:
@@ -162,10 +162,9 @@ export default {
|
|||||||
hideDropdown() {
|
hideDropdown() {
|
||||||
this.isDropdownOpen = false
|
this.isDropdownOpen = false
|
||||||
},
|
},
|
||||||
logout() {
|
async logout() {
|
||||||
this.$auth.user = null
|
this.$cookies.set('auth-token-reset', true)
|
||||||
this.$cookies.remove('auth-token')
|
await this.$router.go(null)
|
||||||
this.$router.go(null)
|
|
||||||
},
|
},
|
||||||
changeTheme() {
|
changeTheme() {
|
||||||
this.$colorMode.preference =
|
this.$colorMode.preference =
|
||||||
|
|||||||
@@ -10,12 +10,15 @@ export default async function (context) {
|
|||||||
return context.redirect(context.route.path)
|
return context.redirect(context.route.path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (context.app.$cookies.get('auth-token-reset')) {
|
||||||
|
context.app.$cookies.removeAll()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (context.app.$cookies.get('auth-token')) {
|
if (context.app.$cookies.get('auth-token')) {
|
||||||
const cookie = context.app.$cookies.get('auth-token')
|
const cookie = context.app.$cookies.get('auth-token')
|
||||||
|
|
||||||
await context.store.dispatch('auth/fetchUser', { token: cookie })
|
await context.store.dispatch('auth/fetchUser', { token: cookie })
|
||||||
} else {
|
|
||||||
context.$auth.user = null
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,8 +54,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async logout() {
|
async logout() {
|
||||||
this.$auth.user = null
|
this.$cookies.set('auth-token-reset', true)
|
||||||
this.$cookies.remove('auth-token')
|
|
||||||
await this.$router.replace(
|
await this.$router.replace(
|
||||||
'https://api.modrinth.com/api/v1/auth/init?url=https://modrinth.com/'
|
'https://api.modrinth.com/api/v1/auth/init?url=https://modrinth.com/'
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user