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

Former-commit-id: 9e1ebf686f12d76a202bf8a3b0b16f14f8eb713d [formerly bfc761cc181d6d8880fd86396e69bf5894806f6c] [formerly 774e09b49a2dff07becff48bf048b3b0bd8353ed [formerly 65d3c0fb9b]]
Former-commit-id: 8ab97c0103cde1a9bcf69c1e9af994241fb9d124 [formerly a25dc7feb0755122c7329e3a3bfa61f74418467b]
Former-commit-id: 92e21139ffe04ab23406352e0a5b6131e8cad084
pull/726/head
Henrique Dias 2018-01-04 12:40:45 +00:00
parent fe834aa244
commit 7f3a26e1c0
3 changed files with 9 additions and 2 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 '

View File

@ -1 +0,0 @@
88021017420cd941317b4af47937c56060e5b104