You've already forked AstralRinth
forked from didirus/AstralRinth
More secure custom authentication solution (#126)
* Remove Nuxt Auth from the project, and switch to a custom solution * Replace old testing code * Remove warnings * Add comments to hard to understand function calls in middleware * Use arrow functions
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
<span>Mods</span>
|
||||
</NuxtLink>
|
||||
<client-only>
|
||||
<div v-if="this.$auth.loggedIn" class="section">
|
||||
<div v-if="this.$auth.user" class="section">
|
||||
<NuxtLink to="/dashboard/projects" class="tab">
|
||||
<span>Dashboard</span>
|
||||
</NuxtLink>
|
||||
@@ -28,7 +28,7 @@
|
||||
</section>
|
||||
<section class="column-grow">
|
||||
<client-only>
|
||||
<template v-if="this.$auth.loggedIn">
|
||||
<template v-if="this.$auth.user">
|
||||
<section class="user-controls">
|
||||
<div
|
||||
v-click-outside="hideDropdown"
|
||||
@@ -139,11 +139,6 @@ export default {
|
||||
directives: {
|
||||
ClickOutside,
|
||||
},
|
||||
async fetch() {
|
||||
if (this.$route.query.code) {
|
||||
await this.$auth.setUserToken(this.$route.query.code)
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isDropdownOpen: false,
|
||||
@@ -151,7 +146,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
authUrl() {
|
||||
return `https://api.modrinth.com/api/v1/auth/init?url=http://modrinth.com${this.$route.path}`
|
||||
return `https://api.modrinth.com/api/v1/auth/init?url=https://modrinth.com${this.$route.fullPath}`
|
||||
},
|
||||
userUrl() {
|
||||
return `/user/${this.$auth.user.id}`
|
||||
@@ -168,7 +163,7 @@ export default {
|
||||
this.isDropdownOpen = false
|
||||
},
|
||||
logout() {
|
||||
this.$auth.setToken('local', false)
|
||||
this.$cookies.remove('auth-token')
|
||||
this.$router.go(null)
|
||||
},
|
||||
changeTheme() {
|
||||
@@ -389,9 +384,6 @@ export default {
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
.layout {
|
||||
header {
|
||||
}
|
||||
|
||||
main {
|
||||
.alpha-alert {
|
||||
margin: 1rem;
|
||||
@@ -403,11 +395,4 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1280px) {
|
||||
.layout {
|
||||
header {
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user