fix: error when user have no commands; close #293
parent
0781b961da
commit
65d3c0fb9b
|
@ -8,6 +8,11 @@ function parseToken (token) {
|
||||||
document.cookie = `auth=${token}; max-age=86400; path=${path}`
|
document.cookie = `auth=${token}; max-age=86400; path=${path}`
|
||||||
let res = token.split('.')
|
let res = token.split('.')
|
||||||
let user = JSON.parse(window.atob(res[1]))
|
let user = JSON.parse(window.atob(res[1]))
|
||||||
|
|
||||||
|
if (!user.commands) {
|
||||||
|
user.commands = []
|
||||||
|
}
|
||||||
|
|
||||||
store.commit('setJWT', token)
|
store.commit('setJWT', token)
|
||||||
store.commit('setUser', user)
|
store.commit('setUser', user)
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,11 +163,14 @@ export default {
|
||||||
this.lockPassword = user.lockPassword
|
this.lockPassword = user.lockPassword
|
||||||
this.filesystem = user.filesystem
|
this.filesystem = user.filesystem
|
||||||
this.username = user.username
|
this.username = user.username
|
||||||
this.commands = user.commands.join(' ')
|
|
||||||
this.css = user.css
|
this.css = user.css
|
||||||
this.permissions = user.permissions
|
this.permissions = user.permissions
|
||||||
this.locale = user.locale
|
this.locale = user.locale
|
||||||
|
|
||||||
|
if (user.commands) {
|
||||||
|
this.commands = user.commands.join(' ')
|
||||||
|
}
|
||||||
|
|
||||||
for (let rule of user.rules) {
|
for (let rule of user.rules) {
|
||||||
if (rule.allow) {
|
if (rule.allow) {
|
||||||
this.rules += 'allow '
|
this.rules += 'allow '
|
||||||
|
|
2335
rice-box.go
2335
rice-box.go
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue