Merge branch 'master' of github.com:gradido/gradido

This commit is contained in:
einhornimmond 2021-04-22 11:55:12 +02:00
commit dea2d9597e
6 changed files with 17 additions and 47 deletions

View File

@ -314,7 +314,7 @@ In case of success returns:
- `registerDirect`: code generated by register for check email - `registerDirect`: code generated by register for check email
- `register`: code generated by auto-register via elopage for check email - `register`: code generated by auto-register via elopage for check email
- `info`: can contain additional info strings - `info`: can contain additional info strings
- "user hasn't password": if user hasn't set a password yet (for example if he was registered via elopage) - "user has no password": if user hasn't set a password yet (for example if he was registered via elopage)
- "email already activated": if email was already checked - "email already activated": if email was already checked
- `user`: contain user object - `user`: contain user object
- `created`: timestamp on which account was created - `created`: timestamp on which account was created

View File

@ -102,8 +102,7 @@ export default {
this.$sidebar.displaySidebar(true) this.$sidebar.displaySidebar(true)
}, },
logout() { logout() {
this.$store.dispatch('logout') this.$emit('logout')
this.$router.push('/login')
}, },
}, },
} }

View File

@ -1,7 +1,6 @@
import Vue from 'vue' import Vue from 'vue'
import Vuex from 'vuex' import Vuex from 'vuex'
Vue.use(Vuex) Vue.use(Vuex)
import loginAPI from '../apis/loginAPI'
import communityAPI from '../apis/communityAPI' import communityAPI from '../apis/communityAPI'
import createPersistedState from 'vuex-persistedstate' import createPersistedState from 'vuex-persistedstate'
@ -49,23 +48,19 @@ export const store = new Vuex.Store({
}, },
}, },
actions: { actions: {
login: async ({ dispatch, commit }, data) => { login: ({ dispatch, commit }, data) => {
commit('session_id', data.session_id) commit('session_id', data.session_id)
commit('email', data.email) commit('email', data.email)
}, },
passwordReset: async (data) => {}, passwordReset: (data) => {},
schoepfen: async (data) => { schoepfen: (data) => {
// http://localhost/transaction-creations/ajaxCreate // http://localhost/transaction-creations/ajaxCreate
}, },
createUser: async ({ commit, dispatch }, data) => { createUser: ({ commit, dispatch }, data) => {
commit('session_id', data.session_id) commit('session_id', data.session_id)
commit('email', data.email) commit('email', data.email)
}, },
logout: async ({ commit, state }) => { logout: ({ commit, state }) => {
if (state.session_id) {
const result = await loginAPI.logout(state.session_id)
// The result can be error, but thats ok with us
}
commit('session_id', null) commit('session_id', null)
commit('email', null) commit('email', null)
sessionStorage.clear() sessionStorage.clear()

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="wrapper"> <div class="wrapper">
<notifications></notifications> <notifications></notifications>
<side-bar> <side-bar @logout="logout">
<template slot="links"> <template slot="links">
<b-nav-item href="#!" to="/overview"> <b-nav-item href="#!" to="/overview">
<b-nav-text class="p-0 text-lg text-muted">{{ $t('send') }}</b-nav-text> <b-nav-text class="p-0 text-lg text-muted">{{ $t('send') }}</b-nav-text>
@ -36,6 +36,7 @@
<script> <script>
import PerfectScrollbar from 'perfect-scrollbar' import PerfectScrollbar from 'perfect-scrollbar'
import 'perfect-scrollbar/css/perfect-scrollbar.css' import 'perfect-scrollbar/css/perfect-scrollbar.css'
import loginAPI from '../../apis/loginAPI'
function hasElement(className) { function hasElement(className) {
return document.getElementsByClassName(className).length > 0 return document.getElementsByClassName(className).length > 0
@ -71,6 +72,12 @@ export default {
initScrollbar('sidenav') initScrollbar('sidenav')
} }
}, },
async logout() {
const result = await loginAPI.logout(this.$store.state.session_id)
// do we have to check success?
this.$store.dispatch('logout')
this.$router.push('/login')
},
}, },
mounted() { mounted() {
this.initScrollbar() this.initScrollbar()

View File

@ -37,37 +37,6 @@ export default {
props: { props: {
type: { type: {
type: String, type: String,
default: 'default', // default|light
description: 'Look of the dashboard navbar. Default (Green) or light (gray)',
},
},
computed: {
routeName() {
const { name } = this.$route
return this.capitalizeFirstLetter(name)
},
},
data() {
return {
activeNotifications: false,
showMenu: false,
searchModalVisible: false,
searchQuery: '',
}
},
methods: {
capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1)
},
toggleNotificationDropDown() {
this.activeNotifications = !this.activeNotifications
},
closeDropDown() {
this.activeNotifications = false
},
logout() {
this.$store.dispatch('logout')
this.$router.push('/login')
}, },
}, },
} }

View File

@ -56,7 +56,7 @@ Poco::JSON::Object* JsonLoginViaEmailVerificationCode::handle(Poco::Dynamic::Var
auto user = session->getNewUser(); auto user = session->getNewUser();
if (!user->getModel()->getPasswordHashed()) { if (!user->getModel()->getPasswordHashed()) {
info.add("user hasn't password"); info.add("user has no password");
} }
auto update_email_verification_result = session->updateEmailVerification(code); auto update_email_verification_result = session->updateEmailVerification(code);
if (1 == update_email_verification_result) { if (1 == update_email_verification_result) {