removed all cookies

This commit is contained in:
Moriz Wahl 2021-04-20 00:23:00 +02:00
parent 12bf269908
commit c3c4b52807
11 changed files with 36 additions and 55 deletions

View File

@ -65,7 +65,6 @@
"vue-cli-plugin-i18n": "^1.0.1",
"vue-clickaway": "^2.2.2",
"vue-clipboard2": "^0.3.0",
"vue-cookies": "^1.7.4",
"vue-flatpickr-component": "^8.1.2",
"vue-good-table": "^2.21.3",
"vue-i18n": "^8.22.4",

View File

@ -69,7 +69,6 @@ export default {
methods: {
dismissAlert() {
this.visible = false
this.$store.state.loginfail = false
},
},
}

View File

@ -40,10 +40,10 @@
<span>Transactions</span>
</router-link>
<!--
<router-link to="/activity" class="dropdown-item text-lg text-muted">
<i class="ni ni-calendar-grid-58"></i>
<span>{{ $t('site.navbar.activity') }}</span>
</router-link>
<router-link to="/activity" class="dropdown-item text-lg text-muted">
<i class="ni ni-calendar-grid-58"></i>
<span>{{ $t('site.navbar.activity') }}</span>
</router-link>
-->
<div class="dropdown-divider"></div>
<div @click="logout" class="dropdown-item text-lg text-muted">
@ -132,6 +132,7 @@ export default {
this.$sidebar.displaySidebar(true)
},
logout() {
this.$router.push('/login')
this.$store.dispatch('logout')
},
},

View File

@ -3,7 +3,6 @@ import DashboardPlugin from './plugins/dashboard-plugin'
import App from './App.vue'
import i18n from './i18n.js'
import VeeValidate from './vee-validate.js'
import VueCookies from 'vue-cookies'
// store
import { store } from './store/store'
@ -14,7 +13,6 @@ import router from './routes/router'
// plugin setup
Vue.use(DashboardPlugin)
Vue.config.productionTip = false
Vue.use(VueCookies)
router.beforeEach((to, from, next) => {
if (to.meta.requiresAuth && !store.state.session_id) {

View File

@ -18,7 +18,6 @@ export const store = new Vuex.Store({
language: 'en',
sizeDE: 'normal',
sizeGB: 'big',
loginfail: false,
user: {
name: '',
balance: 0,
@ -38,7 +37,6 @@ export const store = new Vuex.Store({
mutations: {
language: (state, language) => {
state.language = language
$cookies.set('gdd_lang', language)
if (state.language == 'de') {
state.sizeDE = 'big'
state.sizeGB = 'normal'
@ -47,9 +45,6 @@ export const store = new Vuex.Store({
state.sizeGB = 'big'
}
},
loginfail: (state, loginfail) => {
state.loginfail = loginfail
},
email: (state, email) => {
state.email = email
},
@ -68,42 +63,26 @@ export const store = new Vuex.Store({
login: async ({ dispatch, commit }, data) => {
commit('session_id', data.session_id)
commit('email', data.email)
// $cookies.set('gdd_session_id', result.result.data.session_id)
// $cookies.set('gdd_u', data.email)
},
passwordReset: async (data) => {},
schoepfen: async (data) => {
// http://localhost/transaction-creations/ajaxCreate
},
createUser: async ({ commit, dispatch }, data) => {
const result = await loginAPI.create(
data.email,
data.first_name,
data.last_name,
data.password,
)
if (result.success) {
commit('session_id', result.result.data.session_id)
commit('email', data.email)
$cookies.set('gdd_session_id', result.result.data.session_id)
$cookies.set('gdd_u', data.email)
//router.push('/overview')
} else {
// Register failed, we perform a logout
dispatch('logout')
}
commit('session_id', data.session_id)
commit('email', data.email)
},
logout: async ({ commit, state }) => {
if (state.session_id) {
const result = await loginAPI.logout(state.session_id)
// The result can be error, but thats ok with us
}
sessionStorage.clear()
commit('session_id', null)
commit('email', null)
sessionStorage.clear()
},
accountBalance: async ({ commit, dispatch, state }) => {
const result = await communityAPI.balance($cookies.get('gdd_session_id'))
const result = await communityAPI.balance(state.session_id)
if (result.success) {
commit('user_balance', result.result.data.balance)
} else {

View File

@ -1,7 +1,6 @@
import { shallowMount } from '@vue/test-utils'
import KontoOverview from './KontoOverview'
import Vuex from 'vuex'
import VueCookies from 'vue-cookies'
const localVue = global.localVue

View File

@ -40,7 +40,7 @@ export default {
GddTable,
},
created() {
this.$store.dispatch('accountBalance', $cookies.get('gdd_session_id'))
this.$store.dispatch('accountBalance', this.$store.state.session_id)
},
methods: {
setRows(rows) {

View File

@ -116,8 +116,8 @@ export default {
this.activeNotifications = false
},
logout() {
this.$store.dispatch('logout')
this.$router.push('/login')
this.$store.dispatch('logout')
},
},
}

View File

@ -45,7 +45,7 @@
v-model="model.password"
></base-input>
<b-alert v-show="$store.state.loginfail" show variant="warning">
<b-alert v-show="loginfail" show variant="warning">
<span class="alert-text bv-example-row">
<b-row>
<b-col class="col-9 text-left">

View File

@ -141,6 +141,8 @@
</div>
</template>
<script>
import loginAPI from '../../apis/loginAPI'
export default {
name: 'register',
data() {
@ -167,19 +169,28 @@ export default {
togglePasswordVisibility() {
this.passwordVisible = !this.passwordVisible
},
onSubmit() {
this.$store.dispatch('createUser', {
email: this.model.email,
first_name: this.model.firstname,
last_name: this.model.lastname,
emailType: 2,
password: this.model.password,
})
this.model.email = ''
this.model.firstname = ''
this.model.lastname = ''
this.model.password = ''
this.$router.push('/thx')
async onSubmit() {
const result = await loginAPI.create(
this.model.email,
this.model.firstname,
this.model.lastname,
this.password,
)
if (result.success) {
this.$store.dispatch('createUser', {
session_id: result.result.data.session_id,
email: this.model.email,
})
this.model.email = ''
this.model.firstname = ''
this.model.lastname = ''
this.password = ''
this.$router.push('/thx')
} else {
// todo: Display a proper error message!
this.$router.push('/login')
this.$store.dispatch('logout')
}
},
},
computed: {

View File

@ -13249,11 +13249,6 @@ vue-clipboard2@^0.3.0:
dependencies:
clipboard "^2.0.0"
vue-cookies@^1.7.4:
version "1.7.4"
resolved "https://registry.yarnpkg.com/vue-cookies/-/vue-cookies-1.7.4.tgz#d241d0a0431da0795837651d10b4d73e7c8d3e8d"
integrity sha512-mOS5Btr8V9zvAtkmQ7/TfqJIropOx7etDAgBywPCmHjvfJl2gFbH2XgoMghleLoyyMTi5eaJss0mPN7arMoslA==
vue-eslint-parser@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/vue-eslint-parser/-/vue-eslint-parser-2.0.3.tgz#c268c96c6d94cfe3d938a5f7593959b0ca3360d1"