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'], plugins: ['prettier'],
// add your custom rules here // 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> <template>
<div> <div>
<ReviewPopup ref="popup" />
<div <div
ref="container" ref="container"
class="container" class="container"
@ -22,6 +21,7 @@
</template> </template>
<script> <script>
import scopes from '~/privacy-toggles'
export default { export default {
name: 'CookieConsent', name: 'CookieConsent',
fetch() { fetch() {
@ -42,8 +42,10 @@ export default {
methods: { methods: {
hide() { hide() {
this.$store.commit('consent/set_consent', true) this.$store.commit('consent/set_consent', true)
this.$store.commit('consent/add_scope', true) // Accept all scopes
this.$store.commit('consent/remove_scope', true) for (const elem in scopes.settings) {
this.$store.commit('consent/add_scope', elem)
}
this.$store.dispatch('consent/save', this.$cookies) this.$store.dispatch('consent/save', this.$cookies)
this.shown = false 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: { watch: {
$route() { $route() {
this.$refs.nav.className = 'right-group' this.$refs.nav.className = 'right-group'
document.body.style.overflow = 'auto'
}, },
}, },
methods: { methods: {
@ -186,7 +187,18 @@ export default {
}, },
async logout() { async logout() {
this.$cookies.set('auth-token-reset', true) 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) await this.$router.go(null)
}
this.$notify({
group: 'main',
title: 'Logged Out',
text: 'You have logged out successfully!',
type: 'success',
})
}, },
changeTheme() { changeTheme() {
this.$colorMode.preference = this.$colorMode.preference =
@ -198,6 +210,8 @@ export default {
<style lang="scss"> <style lang="scss">
.layout { .layout {
overflow-y: auto;
overflow-x: hidden;
background-color: var(--color-bg); background-color: var(--color-bg);
display: block; display: block;
height: 100vh; height: 100vh;

View File

@ -1,18 +1,17 @@
export default async function (context) { export default async function (context) {
if (!context.from) { if (!context.from) {
if (context.app.$cookies.get('auth-token-reset')) { 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 return
} }
if (context.route.query.code) { if (context.route.query.code) {
const date = new Date() const date = new Date(Date.now() + 6 * 60 * 60 * 1000) // 6 hours
date.setFullYear(new Date().getFullYear() + 1)
context.app.$cookies.set('auth-token', context.route.query.code, { context.app.$cookies.set('auth-token', context.route.query.code, {
secure: true, secure: true,
sameSite: 'Strict', sameSite: 'Strict',
maxAge: 60 * 60 * 2, // 2 hours
httpOnly: true, httpOnly: true,
expires: date, expires: date,
path: '/', path: '/',

View File

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

View File

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

View File

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

View File

@ -90,6 +90,12 @@ export default {
} }
} }
this.$store.dispatch('consent/save', this.$cookies) 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 = { export const actions = {
async fetchUser({ commit }, { token }) { async fetchUser({ commit }, { token }) {
try {
const user = ( const user = (
await this.$axios.get(`https://api.modrinth.com/api/v1/user`, { await this.$axios.get(`https://api.modrinth.com/api/v1/user`, {
headers: { headers: {
@ -37,6 +38,9 @@ export const actions = {
Authorization: token, Authorization: token,
}, },
}) })
} catch (e) {
console.error('Request for user info encountered an error: ', e)
}
}, },
async fetchUserFollows({ commit }, { userId, token }) { async fetchUserFollows({ commit }, { userId, token }) {
const follows = await this.$axios.get( const follows = await this.$axios.get(
@ -47,7 +51,6 @@ export const actions = {
}, },
} }
) )
commit('SET_USER_FOLLOWS', follows) commit('SET_USER_FOLLOWS', follows)
}, },
} }