Fix issues (#158)

* Fix accept all button simply not working

* Switched privacy settings icons to a shield
Fixed auth changing the theme and consent
Fixed server error on log in / out

* Fixed scrolling issue on mobile

* Fixed GPDR concerns
This commit is contained in:
Redblueflame 2021-04-11 17:21:07 +02:00 committed by GitHub
parent c06c3d48d2
commit 487c1a58d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 52 additions and 52 deletions

View File

@ -16,5 +16,7 @@ module.exports = {
],
plugins: ['prettier'],
// add your custom rules here
rules: {},
rules: {
'no-console': 'off',
},
}

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-shield"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"></path></svg>

After

Width:  |  Height:  |  Size: 279 B

View File

@ -1,6 +1,5 @@
<template>
<div>
<ReviewPopup ref="popup" />
<div
ref="container"
class="container"
@ -22,6 +21,7 @@
</template>
<script>
import scopes from '~/privacy-toggles'
export default {
name: 'CookieConsent',
fetch() {
@ -42,8 +42,10 @@ export default {
methods: {
hide() {
this.$store.commit('consent/set_consent', true)
this.$store.commit('consent/add_scope', true)
this.$store.commit('consent/remove_scope', true)
// Accept all scopes
for (const elem in scopes.settings) {
this.$store.commit('consent/add_scope', elem)
}
this.$store.dispatch('consent/save', this.$cookies)
this.shown = false

View File

@ -1,24 +0,0 @@
<template>
<Popup :show-popup="shown"> </Popup>
</template>
<script>
export default {
name: 'ReviewPopup',
data() {
return {
shown: false,
}
},
methods: {
show() {
this.shown = true
},
hide() {
this.shown = false
},
},
}
</script>
<style scoped lang="scss"></style>

View File

@ -165,6 +165,7 @@ export default {
watch: {
$route() {
this.$refs.nav.className = 'right-group'
document.body.style.overflow = 'auto'
},
},
methods: {
@ -186,7 +187,18 @@ export default {
},
async logout() {
this.$cookies.set('auth-token-reset', true)
// If users logs out on dashboard, redirect on the home page
if (this.$route.path.startsWith('/dashboard')) {
await this.$router.push('/')
} else {
await this.$router.go(null)
}
this.$notify({
group: 'main',
title: 'Logged Out',
text: 'You have logged out successfully!',
type: 'success',
})
},
changeTheme() {
this.$colorMode.preference =
@ -198,6 +210,8 @@ export default {
<style lang="scss">
.layout {
overflow-y: auto;
overflow-x: hidden;
background-color: var(--color-bg);
display: block;
height: 100vh;

View File

@ -1,18 +1,17 @@
export default async function (context) {
if (!context.from) {
if (context.app.$cookies.get('auth-token-reset')) {
context.app.$cookies.removeAll()
// Only remove the cookie related to the auth, instead of removing everything
context.app.$cookies.remove('auth-token')
context.app.$cookies.remove('auth-token-reset')
return
}
if (context.route.query.code) {
const date = new Date()
date.setFullYear(new Date().getFullYear() + 1)
const date = new Date(Date.now() + 6 * 60 * 60 * 1000) // 6 hours
context.app.$cookies.set('auth-token', context.route.query.code, {
secure: true,
sameSite: 'Strict',
maxAge: 60 * 60 * 2, // 2 hours
httpOnly: true,
expires: date,
path: '/',

View File

@ -10,8 +10,6 @@ function isAnalyticsOn(ctx) {
cookies = document.cookie;
}
if(!cookies) return true;
let processed = {}
cookies.split(';').forEach((e) => {
let val = e.trim().split('=');

View File

@ -9,9 +9,6 @@ function isPersonalizedAdsOn(ctx) {
// Rely on the client
cookies = document.cookie;
}
if(!cookies) return true;
let processed = {}
cookies.split(';').forEach((e) => {
let val = e.trim().split('=')

View File

@ -30,7 +30,7 @@
Settings
</nuxt-link>
<nuxt-link :to="'/dashboard/privacy'" class="tab last">
<SettingsIcon />
<ShieldIcon />
Privacy Settings
</nuxt-link>
</div>
@ -60,6 +60,7 @@ import SettingsIcon from '~/assets/images/sidebar/settings.svg?inline'
import NotificationsIcon from '~/assets/images/sidebar/notifications.svg?inline'
import FollowIcon from '~/assets/images/utils/heart.svg?inline'
import UserIcon from '~/assets/images/utils/user.svg?inline'
import ShieldIcon from '~/assets/images/utils/shield.svg?inline'
export default {
name: 'DashboardPage',
@ -70,6 +71,7 @@ export default {
NotificationsIcon,
FollowIcon,
UserIcon,
ShieldIcon,
},
computed: {
authUrl() {

View File

@ -90,6 +90,12 @@ export default {
}
}
this.$store.dispatch('consent/save', this.$cookies)
this.$notify({
group: 'main',
title: 'Saved',
text: 'Your preferences have been saved successfully.',
type: 'success',
})
},
},
}

View File

@ -22,6 +22,7 @@ export const mutations = {
export const actions = {
async fetchUser({ commit }, { token }) {
try {
const user = (
await this.$axios.get(`https://api.modrinth.com/api/v1/user`, {
headers: {
@ -37,6 +38,9 @@ export const actions = {
Authorization: token,
},
})
} catch (e) {
console.error('Request for user info encountered an error: ', e)
}
},
async fetchUserFollows({ commit }, { userId, token }) {
const follows = await this.$axios.get(
@ -47,7 +51,6 @@ export const actions = {
},
}
)
commit('SET_USER_FOLLOWS', follows)
},
}