fix: error when user have no commands; close #293

pull/329/head
Henrique Dias 2018-01-04 12:40:45 +00:00
parent 0781b961da
commit 65d3c0fb9b
3 changed files with 9 additions and 2336 deletions

View File

@ -8,6 +8,11 @@ function parseToken (token) {
document.cookie = `auth=${token}; max-age=86400; path=${path}`
let res = token.split('.')
let user = JSON.parse(window.atob(res[1]))
if (!user.commands) {
user.commands = []
}
store.commit('setJWT', token)
store.commit('setUser', user)
}

View File

@ -163,11 +163,14 @@ export default {
this.lockPassword = user.lockPassword
this.filesystem = user.filesystem
this.username = user.username
this.commands = user.commands.join(' ')
this.css = user.css
this.permissions = user.permissions
this.locale = user.locale
if (user.commands) {
this.commands = user.commands.join(' ')
}
for (let rule of user.rules) {
if (rule.allow) {
this.rules += 'allow '

File diff suppressed because one or more lines are too long