diff --git a/src/App.vue b/src/App.vue
index 8db0818..417b731 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -3,9 +3,35 @@
- © {{ new Date().getFullYear() }} Studentenclub Wu 5 e.v.
+
+
+
+ {{ calcTime }}
+
+
+
+
+
+ Zeit bis zum Logout ändern
+
+
+
+
+
+
+ Abbrechen
+ Speichern
+
+
+
@@ -13,12 +39,123 @@
diff --git a/src/components/TitleBar.vue b/src/components/TitleBar.vue
index eb00664..d480505 100644
--- a/src/components/TitleBar.vue
+++ b/src/components/TitleBar.vue
@@ -1,6 +1,6 @@
-
+
Flaschengeist
diff --git a/src/components/baruser/CreditLists.vue b/src/components/baruser/CreditLists.vue
index 9a9e4d5..b312a2d 100644
--- a/src/components/baruser/CreditLists.vue
+++ b/src/components/baruser/CreditLists.vue
@@ -161,11 +161,22 @@
-
+
-
- {{plus}}
+
+ {{ plus }}
@@ -209,7 +220,7 @@
diff --git a/src/plugins/routes.js b/src/plugins/routes.js
index 06f86a8..547b80f 100644
--- a/src/plugins/routes.js
+++ b/src/plugins/routes.js
@@ -5,6 +5,7 @@ const main = 'http://localhost:5000/'
const url = {
login: main + 'login',
+ logout: main + 'logout',
getUsers: main + 'getUsers',
pricelist: main + 'pricelist',
getTypes: main + 'drinkTypes',
@@ -23,6 +24,8 @@ const url = {
finanzerSendOneMail: main + 'finanzerSendOneMail',
userMain: main + 'user/main',
userAddAmount: main + 'user/addAmount',
+ saveLifeTime: main + 'saveLifeTime',
+ getLifeTime: main + 'getLifeTime',
vorstand: {
sm: {
addUser: main + 'sm/addUser',
diff --git a/src/store/modules/barUsers.js b/src/store/modules/barUsers.js
index d2bca91..cacf3ed 100644
--- a/src/store/modules/barUsers.js
+++ b/src/store/modules/barUsers.js
@@ -128,6 +128,7 @@ const actions = {
headers: { Token: rootState.login.user.accessToken }
})
commit('setUsers', response.data)
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
@@ -152,6 +153,7 @@ const actions = {
amount: data.amount,
error: false
})
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
commit('addMessage', {
user: data.user,
@@ -180,6 +182,7 @@ const actions = {
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('setUsers', { [response.data.username]: response.data })
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
@@ -197,6 +200,7 @@ const actions = {
headers: { Token: rootState.login.user.accessToken }
})
commit('setAllUsers', response.data)
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.data === 401) dispatch('logout', null, { root: true })
@@ -216,6 +220,7 @@ const actions = {
)
commit('setUsers', { [response.data.username]: response.data })
commit('updateMessage', { date: data.date, storno: true })
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
diff --git a/src/store/modules/finanzerUsers.js b/src/store/modules/finanzerUsers.js
index 66b31e5..2a16b17 100644
--- a/src/store/modules/finanzerUsers.js
+++ b/src/store/modules/finanzerUsers.js
@@ -247,6 +247,7 @@ const actions = {
headers: { Token: rootState.login.user.accessToken }
})
commit('setAllUsers', response.data)
+ dispatch('getLifeTime', null, { root: true })
} catch (err) {
if (err.response)
if (err.response.status === 401)
@@ -261,6 +262,7 @@ const actions = {
headers: { Token: rootState.login.user.accessToken }
})
commit('setUsers', response.data)
+ dispatch('getLifeTime', null, { root: true })
} catch (err) {
if (err.response)
if (err.response.status === 401)
@@ -291,6 +293,7 @@ const actions = {
locked: response.data.locked,
username: data.user.username
})
+ dispatch('getLifeTime', null, { root: true })
} catch (err) {
if (err.response)
if (err.response.status === 401)
@@ -318,6 +321,7 @@ const actions = {
locked: response.data.locked,
username: data.user.username
})
+ dispatch('getLifeTime', null, { root: true })
} catch (err) {
if (err.response)
if (err.response.status === 401)
@@ -334,6 +338,7 @@ const actions = {
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('updateUsers', response.data)
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
@@ -353,6 +358,7 @@ const actions = {
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('updateUsers', response.data)
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
@@ -368,6 +374,7 @@ const actions = {
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('setUsers', response.data)
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
@@ -381,6 +388,7 @@ const actions = {
headers: { Token: rootState.login.user.accessToken }
})
commit('setMails', response.data)
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
@@ -396,6 +404,7 @@ const actions = {
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('setMail', response.data)
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
diff --git a/src/store/modules/jobRequests.js b/src/store/modules/jobRequests.js
index 45267f7..bf93872 100644
--- a/src/store/modules/jobRequests.js
+++ b/src/store/modules/jobRequests.js
@@ -82,6 +82,7 @@ const actions = {
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('setTransactJobs', response.data)
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.data === 401) dispatch('logout', null, { root: true })
@@ -98,6 +99,7 @@ const actions = {
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('setRequestJobs', response.data)
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.data === 401) dispatch('logout', null, { root: true })
@@ -113,6 +115,7 @@ const actions = {
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('updateRequestJob', response.data)
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.data === 401) dispatch('logout', null, { root: true })
@@ -126,6 +129,7 @@ const actions = {
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('deleteTransactJobactJob', data)
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.data === 401) dispatch('logout', null, { root: true })
diff --git a/src/store/modules/jobs.js b/src/store/modules/jobs.js
index 15d6a32..db6c20e 100644
--- a/src/store/modules/jobs.js
+++ b/src/store/modules/jobs.js
@@ -211,6 +211,7 @@ const actions = {
users: response.data,
username: rootState.login.user.username
})
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.data === 401) dispatch('logout', null, { root: true })
@@ -247,6 +248,7 @@ const actions = {
day: response.data.day
})
commit('setDayNotLoading', { date: data.startdatetime, getters })
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
@@ -262,6 +264,7 @@ const actions = {
}
)
commit('updateMonth', { ...response.data[0], com: 'add' })
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
@@ -280,6 +283,7 @@ const actions = {
user: rootState.login.user,
com: 'delete'
})
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
@@ -292,6 +296,7 @@ const actions = {
{ ...data },
{ headers: { Token: rootState.login.user.accessToken } }
)
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
diff --git a/src/store/modules/login.js b/src/store/modules/login.js
index dbecdb1..5501fd4 100644
--- a/src/store/modules/login.js
+++ b/src/store/modules/login.js
@@ -13,7 +13,8 @@ const state = {
loggingIn: false,
loginError: null,
cookieNotification: true,
- cookieAccepted: false
+ cookieAccepted: false,
+ lifeTime: 1800
}
const mutations = {
@@ -50,6 +51,9 @@ const mutations = {
},
setCookieAccepted(state, value) {
state.cookieAccepted = value
+ },
+ setLifeTime(state, value) {
+ state.lifeTime = value
}
}
@@ -100,13 +104,17 @@ const actions = {
fetchAccessToken({ commit }) {
commit('updateAccessToken', localStorage.getItem('user'))
},
- logout({ commit }) {
+ logout({ commit, rootState }) {
+ var accessToken = rootState.login.user.accessToken
localStorage.removeItem('user')
localStorage.removeItem('cookie:accepted')
commit('setCookieNotification', true)
commit('setCookieAccepted', false)
commit('logout')
router.push('/login')
+ axios.get(url.logout, {
+ headers: { Token: accessToken }
+ })
},
resetLoginError({ commit }) {
commit('loginStop')
@@ -122,6 +130,36 @@ const actions = {
getCookieAccepted({ commit }) {
var cookie = localStorage.getItem('cookie:accepted')
commit('setCookieAccepted', cookie)
+ },
+ setLifeTime({ commit }, value) {
+ commit('setLifeTime', value)
+ },
+ async saveLifeTime({ commit, rootState, dispatch }, value) {
+ try {
+ const response = await axios.post(
+ url.saveLifeTime,
+ { value: value },
+ { headers: { Token: rootState.login.user.accessToken } }
+ )
+ commit('setLifeTime', response.data.value)
+ } catch (e) {
+ if (e.response)
+ if (e.response.status === 401) dispatch('logout', null, { root: true })
+ }
+ },
+ async getLifeTime({ commit, rootState, dispatch }) {
+ try {
+ if (!rootState.login.user.accessToken) {
+ return
+ }
+ const response = await axios.get(url.getLifeTime, {
+ headers: { Token: rootState.login.user.accessToken }
+ })
+ commit('setLifeTime', response.data.value)
+ } catch (e) {
+ if (e.response)
+ if (e.response.status === 401) dispatch('logout', null, { root: true })
+ }
}
}
@@ -201,6 +239,9 @@ const getters = {
},
cookieAccepted: state => {
return state.cookieAccepted
+ },
+ lifeTime: state => {
+ return state.lifeTime
}
}
diff --git a/src/store/modules/pricelist.js b/src/store/modules/pricelist.js
index 26e545f..ac1a444 100644
--- a/src/store/modules/pricelist.js
+++ b/src/store/modules/pricelist.js
@@ -95,22 +95,24 @@ const mutations = {
}
const actions = {
- async getPriceList({ commit }) {
+ async getPriceList({ commit, dispatch }) {
try {
commit('setPriceListLoading', true)
const response = await axios.get(url.pricelist)
commit('setPriceList', response.data)
commit('setPriceListLoading', false)
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
commit('setPriceListLoading', false)
}
},
- async getTypes({ commit }) {
+ async getTypes({ commit, dispatch }) {
try {
commit('setTypesLoading', true)
const response = await axios.get(url.getTypes)
commit('setTypes', response.data)
commit('setTypesLoading', false)
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
commit('setTypesLoading', false)
}
@@ -125,6 +127,7 @@ const actions = {
)
commit('updatePriceList', response.data)
commit('setPriceListLoading', false)
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
commit('setPriceListLoading', false)
if (e.response)
@@ -141,6 +144,7 @@ const actions = {
)
commit('updatePriceList', response.data)
commit('setPriceListLoading', false)
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
commit('setPriceListLoading', false)
if (e.response)
@@ -157,6 +161,7 @@ const actions = {
)
commit('deleteDrinkPrice', data)
commit('setPriceListLoading', false)
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
commit('setPriceListLoading', false)
if (e.response)
@@ -173,6 +178,7 @@ const actions = {
)
commit('updateDrinkType', response.data)
commit('setTypesLoading', false)
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
commit('setTypesLoading', false)
if (e.response)
@@ -189,6 +195,7 @@ const actions = {
)
commit('updateDrinkType', response.data)
commit('setTypesLoading', false)
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
commit('setTypesLoading', false)
if (e.response)
@@ -205,6 +212,7 @@ const actions = {
)
commit('deleteDrinkType', data)
commit('setTypesLoading', false)
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
commit('setTypesLoading', false)
if (e.response)
diff --git a/src/store/modules/serviceManagement.js b/src/store/modules/serviceManagement.js
index 51ad6db..9910bf6 100644
--- a/src/store/modules/serviceManagement.js
+++ b/src/store/modules/serviceManagement.js
@@ -204,6 +204,7 @@ const actions = {
headers: { Token: rootState.login.user.accessToken }
})
commit('setAllUsers', response.data)
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.data === 401) dispatch('logout', null, { root: true })
@@ -220,6 +221,7 @@ const actions = {
}
)
commit('updateMonth', { ...response.data[0], com: 'add' })
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
@@ -245,6 +247,7 @@ const actions = {
day: response.data.day
})
commit('setDayNotLoading', { date: data.startdatetime, getters })
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
@@ -260,6 +263,7 @@ const actions = {
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('updateMonth', { ...data, com: 'delete' })
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
@@ -273,6 +277,7 @@ const actions = {
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('updateMonth', { start: response.data.date, day: response.data })
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index fdb3c9f..c25ea1a 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -210,6 +210,7 @@ const actions = {
})
commit('setUser', response.data)
commit('setError', '')
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
@@ -231,6 +232,7 @@ const actions = {
error: false
})
commit('setError', '')
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
commit('addMessage', {
user: rootState.login.user,
@@ -252,6 +254,7 @@ const actions = {
)
commit('setUser', response.data)
commit('setError', '')
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response) {
if (e.response.status === 401) dispatch('logout', null, { root: true })
@@ -274,6 +277,7 @@ const actions = {
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('updateDay', { ...response.data, date: data.date })
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response) {
if (e.response.status === 401) dispatch('logout', null, { root: true })
@@ -296,6 +300,7 @@ const actions = {
)
commit('setUser', response.data)
commit('updateMessage', { date: data.date, storno: true })
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
@@ -308,6 +313,7 @@ const actions = {
headers: { Token: rootState.login.user.accessToken }
})
commit('setStatus', response.data)
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
diff --git a/src/store/modules/userManager.js b/src/store/modules/userManager.js
index 6284a40..d60a75f 100644
--- a/src/store/modules/userManager.js
+++ b/src/store/modules/userManager.js
@@ -71,6 +71,7 @@ const actions = {
})
commit('setUsers', response.data)
commit('setUsersLoading', false)
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
commit('setUsersLoading', false)
if (e.response)
@@ -85,6 +86,7 @@ const actions = {
})
commit('setStatus', response.data)
commit('setStatusLoading', false)
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
commit('setStatusLoading', false)
if (e.response)
@@ -101,6 +103,7 @@ const actions = {
)
commit('updateUser', response.data)
commit('setUsersLoading', false)
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
commit('setUsersLoading', false)
if (e.response)
@@ -117,6 +120,7 @@ const actions = {
)
commit('updateUser', response.data)
commit('setUsersLoading', false)
+ dispatch('getLifeTime', null, { root: true })
} catch (e) {
commit('setUsersLoading', false)
if (e.response)