mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
checks that a cookie exists after login. If not, throw an error saying that no cookie can be set
This commit is contained in:
parent
4b0893c1df
commit
c405e008e4
@ -91,7 +91,11 @@ export default {
|
||||
this.$toast.success(this.$t('login.success'))
|
||||
this.$emit('success')
|
||||
} catch (err) {
|
||||
this.$toast.error(this.$t('login.failure'))
|
||||
if (err.message === 'Error: no-cookie') {
|
||||
this.$toast.error(this.$t('login.no-cookie'))
|
||||
} else {
|
||||
this.$toast.error(this.$t('login.failure'))
|
||||
}
|
||||
}
|
||||
},
|
||||
toggleShowPassword(event) {
|
||||
|
||||
@ -315,6 +315,7 @@
|
||||
"moreInfo": "Was ist {APPLICATION_NAME}?",
|
||||
"moreInfoHint": "zur Präsentationsseite",
|
||||
"no-account": "Du hast noch kein Benutzerkonto?",
|
||||
"no-cookie": "Es kann kein Cookie angelegt werden. Du must Cookies akzeptieren.",
|
||||
"password": "Dein Passwort",
|
||||
"register": "Benutzerkonto erstellen",
|
||||
"success": "Du bist eingeloggt!"
|
||||
|
||||
@ -315,6 +315,7 @@
|
||||
"moreInfo": "What is {APPLICATION_NAME}?",
|
||||
"moreInfoHint": "to the presentation page",
|
||||
"no-account": "Don't have an account?",
|
||||
"no-cookie": "No cookie can be set. You must accept cookies.",
|
||||
"password": "Your Password",
|
||||
"register": "Sign up",
|
||||
"success": "You are logged in!"
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { VERSION } from '~/constants/terms-and-conditions-version.js'
|
||||
import { currentUserQuery } from '~/graphql/User'
|
||||
import Cookie from 'universal-cookie'
|
||||
|
||||
const cookies = new Cookie()
|
||||
|
||||
export const state = () => {
|
||||
return {
|
||||
@ -99,6 +102,9 @@ export const actions = {
|
||||
await this.app.$apolloHelpers.onLogin(login)
|
||||
commit('SET_TOKEN', login)
|
||||
await dispatch('fetchCurrentUser')
|
||||
if (cookies.get('ocelot-social-token') === undefined) {
|
||||
throw new Error('no-cookie')
|
||||
}
|
||||
} catch (err) {
|
||||
throw new Error(err)
|
||||
} finally {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user