Merge branch 'feature/accessToken' into develop
This commit is contained in:
commit
b812b86b6a
|
@ -48,7 +48,7 @@
|
|||
<v-col cols="12" sm="6">
|
||||
<v-text-field
|
||||
outlined
|
||||
label="Password"
|
||||
label="neues Password"
|
||||
type="password"
|
||||
v-model="password"
|
||||
/>
|
||||
|
@ -58,7 +58,7 @@
|
|||
ref="password"
|
||||
v-model="controlPassword"
|
||||
outlined
|
||||
label="Password bestätigen"
|
||||
label="neues Password bestätigen"
|
||||
type="password"
|
||||
:disabled="!password"
|
||||
:rules="[equal_password]"
|
||||
|
@ -162,14 +162,87 @@
|
|||
append-icon
|
||||
>
|
||||
<template v-slot:selection="data">
|
||||
<v-chip>{{data.item.name}}</v-chip>
|
||||
<v-chip>{{ data.item.name }}</v-chip>
|
||||
</template>
|
||||
</v-combobox>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<div class="subtitle-1">
|
||||
Gespeicherte Sessions
|
||||
</div>
|
||||
<v-card v-for="token in tokens" :key="token.id" outlined>
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col
|
||||
>OS:
|
||||
<v-icon>
|
||||
{{
|
||||
token.platform === 'macos' || token.platform === 'iphone'
|
||||
? apple
|
||||
: token.platform === 'windows'
|
||||
? windows
|
||||
: token.platfrom === 'android'
|
||||
? android
|
||||
: token.platform
|
||||
}}
|
||||
</v-icon>
|
||||
<v-icon
|
||||
v-if="
|
||||
token.platform === 'macos' || token.platform === 'iphone'
|
||||
"
|
||||
>
|
||||
{{ token.platform === 'macos' ? mac : iphone }}
|
||||
</v-icon>
|
||||
</v-col>
|
||||
<v-col>
|
||||
Browser:
|
||||
<v-icon>
|
||||
{{
|
||||
token.browser === 'chrome'
|
||||
? chrome
|
||||
: token.browser === 'firefox'
|
||||
? firefox
|
||||
: token.browser === 'opera'
|
||||
? opera
|
||||
: token.browser === 'safari'
|
||||
? safari
|
||||
: token.browser
|
||||
}}
|
||||
</v-icon>
|
||||
</v-col>
|
||||
<v-col>
|
||||
Letzter Aktualisierung: {{ token.timestamp.day }}.{{
|
||||
token.timestamp.month
|
||||
}}.{{ token.timestamp.year }} um
|
||||
{{
|
||||
10 > token.timestamp.hour
|
||||
? '0' + String(token.timestamp.hour)
|
||||
: token.timestamp.hour
|
||||
}}:{{
|
||||
10 > token.timestamp.minute
|
||||
? '0' + String(token.timestamp.minute)
|
||||
: token.timestamp.minute
|
||||
}}:{{
|
||||
10 > token.timestamp.second
|
||||
? '0' + String(token.timestamp.second)
|
||||
: token.timestamp.second
|
||||
}}
|
||||
</v-col>
|
||||
<v-col>Lebenszeit: {{ calcLifefime(token.lifetime) }}</v-col>
|
||||
<v-col>
|
||||
<v-btn icon @click="deleteToken(token)">
|
||||
<v-icon>
|
||||
{{trashCan}}
|
||||
</v-icon>
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-text-field outlined label="Passwort" v-model="acceptedPassword" type="password" ref="acceptedPassword" :rules="[empty_password]"></v-text-field>
|
||||
<v-btn text color="primary" @click="save">Speicherns</v-btn>
|
||||
</v-card-actions>
|
||||
<v-expand-transition>
|
||||
|
@ -184,13 +257,34 @@ import {
|
|||
mdiAccount,
|
||||
mdiGlassCocktail,
|
||||
mdiCurrencyEur,
|
||||
mdiFoodForkDrink
|
||||
mdiFoodForkDrink,
|
||||
mdiApple,
|
||||
mdiGoogleChrome,
|
||||
mdiFirefox,
|
||||
mdiOpera,
|
||||
mdiInternetExplorer,
|
||||
mdiAppleSafari,
|
||||
mdiLaptopMac,
|
||||
mdiCellphoneIphone,
|
||||
mdiTrashCan,
|
||||
mdiAndroid,
|
||||
mdiWindows
|
||||
} from '@mdi/js'
|
||||
import { mapGetters, mapActions } from 'vuex'
|
||||
export default {
|
||||
name: 'Config',
|
||||
data() {
|
||||
return {
|
||||
apple: mdiApple,
|
||||
mac: mdiLaptopMac,
|
||||
iphone: mdiCellphoneIphone,
|
||||
android: mdiAndroid,
|
||||
mdiWindows: mdiWindows,
|
||||
chrome: mdiGoogleChrome,
|
||||
firefox: mdiFirefox,
|
||||
opera: mdiOpera,
|
||||
ie: mdiInternetExplorer,
|
||||
safari: mdiAppleSafari,
|
||||
person: mdiAccount,
|
||||
bar: mdiGlassCocktail,
|
||||
finanzer: mdiCurrencyEur,
|
||||
|
@ -201,7 +295,10 @@ export default {
|
|||
lastname: null,
|
||||
password: null,
|
||||
controlPassword: null,
|
||||
trashCan: mdiTrashCan,
|
||||
isFulllineText: false,
|
||||
acceptedPassword: null,
|
||||
passError: null,
|
||||
equal_password: value =>
|
||||
this.password === value || 'Passwörter sind nicht identisch.',
|
||||
email: value => {
|
||||
|
@ -210,7 +307,11 @@ export default {
|
|||
return pattern.test(value) || 'keine gültige E-Mail'
|
||||
}
|
||||
return true
|
||||
},
|
||||
empty_password: () => {
|
||||
return this.acceptedPassword !== null ? true : 'Password wurde nicht gesetzt'
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
@ -222,7 +323,9 @@ export default {
|
|||
methods: {
|
||||
...mapActions({
|
||||
saveConfig: 'user/saveConfig',
|
||||
getStatus: 'user/getStatus'
|
||||
getStatus: 'user/getStatus',
|
||||
getTokens: 'user/getTokens',
|
||||
deleteToken: 'user/deleteToken'
|
||||
}),
|
||||
getWindowWidth() {
|
||||
this.isFulllineText = document.documentElement.clientWidth <= 600
|
||||
|
@ -238,9 +341,29 @@ export default {
|
|||
if (this.$refs.password.validate()) {
|
||||
if (this.password) user.password = this.password
|
||||
}
|
||||
this.saveConfig({ oldUsername: user.username, ...user })
|
||||
if (this.$refs.acceptedPassword.validate()) {
|
||||
this.saveConfig({oldUsername: user.username, ...user, acceptedPassword: this.acceptedPassword})
|
||||
} else {
|
||||
this.passError = "Du musst dein Password eingeben"
|
||||
}
|
||||
this.password = null
|
||||
this.controlPassword = null
|
||||
this.acceptedPassword = ''
|
||||
},
|
||||
calcLifefime(time) {
|
||||
if (time < 60) return String(time) + 'Sekunden'
|
||||
time = Math.round(time / 60)
|
||||
if (time < 60) return String(time) + 'Minuten'
|
||||
time = Math.round(time / 60)
|
||||
if (time < 24) return String(time) + 'Stunden'
|
||||
time = Math.round(time / 24)
|
||||
if (time < 7) return String(time) + 'Tage'
|
||||
time = Math.round(time / 7)
|
||||
if (time < 30) return String(time) + 'Wochen'
|
||||
time = Math.round(time / 30)
|
||||
if (time < 12) return String(time) + 'Monate'
|
||||
time = Math.round(time / 12)
|
||||
return String(time) + 'Jahre'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -248,7 +371,8 @@ export default {
|
|||
user: 'user/user',
|
||||
error: 'user/error',
|
||||
loading: 'user/loading',
|
||||
status: 'user/status'
|
||||
status: 'user/status',
|
||||
tokens: 'user/tokens'
|
||||
}),
|
||||
lock() {
|
||||
return this.user.locked ? 'gesperrt' : 'nicht gesperrt'
|
||||
|
@ -272,6 +396,7 @@ export default {
|
|||
},
|
||||
created() {
|
||||
this.getStatus()
|
||||
this.getTokens()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
</v-card-title>
|
||||
<v-card-text>
|
||||
<v-expand-transition>
|
||||
<v-row align="center" justify="center" v-if="dayLoading">
|
||||
<v-row align="center" justify="center" v-if="day.loading">
|
||||
<v-progress-circular indeterminate color="grey" />
|
||||
</v-row>
|
||||
</v-expand-transition>
|
||||
<v-expand-transition>
|
||||
<div v-show="!dayLoading">
|
||||
<div v-show="!day.loading">
|
||||
<div
|
||||
v-for="(jobkinddateitem, index) in day.jobkinddate"
|
||||
:key="index"
|
||||
|
@ -43,7 +43,7 @@
|
|||
</div>
|
||||
</v-expand-transition>
|
||||
</v-card-text>
|
||||
<v-card-actions class="text--secondary" v-if="!dayLoading" :key="update">
|
||||
<v-card-actions class="text--secondary" v-if="!day.loading" :key="update">
|
||||
<v-spacer />
|
||||
<v-menu
|
||||
v-model="menu"
|
||||
|
@ -94,7 +94,7 @@
|
|||
v-for="(invite, index) in getInvites(day.date)"
|
||||
:key="index"
|
||||
>
|
||||
<v-chip v-on="on" style="margin: 5px">
|
||||
<v-chip style="margin: 5px">
|
||||
{{ invite.to_user.firstname }}
|
||||
{{ invite.to_user.lastname }}
|
||||
</v-chip>
|
||||
|
@ -152,7 +152,7 @@
|
|||
v-for="(request, index) in getRequests(day.date)"
|
||||
:key="index"
|
||||
>
|
||||
<v-chip v-on="on" style="margin: 5px">
|
||||
<v-chip style="margin: 5px">
|
||||
{{ request.to_user.firstname }}
|
||||
{{ request.to_user.lastname }}
|
||||
</v-chip>
|
||||
|
@ -344,7 +344,6 @@ export default {
|
|||
return jobkinddate.job_kind
|
||||
},
|
||||
filteredDBUsersWithJobKind() {
|
||||
console.log(this.day.jobkinddate)
|
||||
var retVal = this.filteredDBUsers()
|
||||
var job_kind = this.getJob_Kind()
|
||||
|
||||
|
|
|
@ -72,7 +72,8 @@ const url = {
|
|||
storno: main + 'user/storno',
|
||||
getAllStatus: main + 'getAllStatus',
|
||||
getStatus: main + 'getStatus',
|
||||
valid: main + 'valid'
|
||||
valid: main + 'valid',
|
||||
getAccessTokens: main + 'user/getAccessTokens'
|
||||
},
|
||||
barU: {
|
||||
storno: main + 'bar/storno',
|
||||
|
|
|
@ -158,13 +158,11 @@ const mutations = {
|
|||
: []
|
||||
}
|
||||
})
|
||||
console.log(mop)
|
||||
},
|
||||
setDayLoading: (state, { getters, date, value }) => {
|
||||
let day = getters.getDayToMe(date)
|
||||
day.forEach(a => {
|
||||
a.day.loading = value
|
||||
console.log('day', value ? 'loading' : 'not loading', day, a.day.loading)
|
||||
})
|
||||
},
|
||||
deleteJobRequestFromMe: (state, jobrequest) => {
|
||||
|
@ -240,7 +238,6 @@ const actions = {
|
|||
to_me.data,
|
||||
{ headers: { Token: rootState.login.user.accessToken } }
|
||||
)
|
||||
console.log(to_me.data)
|
||||
commit('setJobRequestsToMe', to_me.data)
|
||||
workers_to_me.data.forEach(item => {
|
||||
var date = new Date(
|
||||
|
|
|
@ -157,9 +157,7 @@ const actions = {
|
|||
})
|
||||
commit('setLifeTime', response.data.value)
|
||||
var user = JSON.parse(localStorage.getItem('user'))
|
||||
console.log('user',user)
|
||||
user.group = response.data.group
|
||||
console.log('after',user)
|
||||
localStorage.setItem('user', JSON.stringify(user))
|
||||
commit('updateAccessToken', user)
|
||||
} catch (e) {
|
||||
|
|
|
@ -9,7 +9,8 @@ const state = {
|
|||
error: '',
|
||||
days: [],
|
||||
messages: [],
|
||||
status: []
|
||||
status: [],
|
||||
tokens: []
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
|
@ -29,6 +30,9 @@ const mutations = {
|
|||
state.creditList = []
|
||||
state.error = ''
|
||||
},
|
||||
setTokens: (state, tokens) => {
|
||||
state.tokens = tokens
|
||||
},
|
||||
createAmount(creditList) {
|
||||
let amount = {
|
||||
type: 'Schulden',
|
||||
|
@ -317,6 +321,26 @@ const actions = {
|
|||
if (e.response)
|
||||
if (e.response.status === 401) dispatch('logout', null, { root: true })
|
||||
}
|
||||
},
|
||||
async getTokens({ commit, rootState, dispatch }) {
|
||||
try {
|
||||
const response = await axios.get(url.user.getAccessTokens, {headers: {Token: rootState.login.user.accessToken}})
|
||||
commit('setTokens', response.data)
|
||||
dispatch('getLifeTime', null, { root: true })
|
||||
} catch (e) {
|
||||
if (e.response)
|
||||
if (e.response.status === 401) dispatch('logout', null, { root: true })
|
||||
}
|
||||
},
|
||||
async deleteToken({ commit, rootState, dispatch }, token) {
|
||||
try {
|
||||
const response = await axios.post(url.user.getAccessTokens, token,{headers: {Token: rootState.login.user.accessToken}})
|
||||
commit('setTokens', response.data)
|
||||
dispatch('getLifeTime', null, { root: true })
|
||||
} catch (e) {
|
||||
if (e.response)
|
||||
if (e.response.status === 401) dispatch('logout', null, { root: true })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -349,6 +373,9 @@ const getters = {
|
|||
},
|
||||
status: state => {
|
||||
return state.status
|
||||
},
|
||||
tokens: state => {
|
||||
return state.tokens
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,6 @@ const actions = {
|
|||
const response = await axios.get(url.getUsers, {
|
||||
headers: { Token: rootState.login.user.accessToken }
|
||||
})
|
||||
console.log(response.data)
|
||||
commit('setUsers', response.data)
|
||||
commit('setUsersLoading', false)
|
||||
dispatch('getLifeTime', null, { root: true })
|
||||
|
@ -95,7 +94,6 @@ const actions = {
|
|||
const response = await axios.get(url.getUsers + '?extern=1', {
|
||||
headers: { Token: rootState.login.user.accessToken }
|
||||
})
|
||||
console.log(response.data)
|
||||
commit('setUsers', response.data)
|
||||
commit('setUsersLoading', false)
|
||||
dispatch('getLifeTime', null, { root: true })
|
||||
|
|
Loading…
Reference in New Issue