|
@@ -174,9 +174,11 @@ const checkUpdate = () => {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+const getMagicTokenValue = () => (config.getMagicTokenValue && config.getMagicTokenValue()) || store.get(constants.STORE.token) || constants.HEADER_MAGIC_TOKEN_VALUE
|
|
|
const autoLogin = () => {
|
|
|
return new Promise(resolve => {
|
|
|
- constants.HEADER_MAGIC_TOKEN_VALUE = store.get(constants.STORE.token) || constants.HEADER_MAGIC_TOKEN_VALUE
|
|
|
+ constants.HEADER_MAGIC_TOKEN_VALUE = getMagicTokenValue()
|
|
|
bus.status('message.tryAutoLogin')
|
|
|
request.sendPost('/login').success(isLogin => {
|
|
|
showLogin.value = !isLogin
|
|
@@ -276,7 +278,7 @@ bus.$on(Message.MESSAGE, (msgType, content) => {
|
|
|
})
|
|
|
bus.$event(Socket.OPEN, () => {
|
|
|
constants.CLIENT_ID = randomString(16)
|
|
|
- nextTick(() => bus.send(Socket.LOGIN, [constants.HEADER_MAGIC_TOKEN_VALUE, constants.CLIENT_ID].join(',')))
|
|
|
+ nextTick(() => bus.send(Socket.LOGIN, [getMagicTokenValue(), constants.CLIENT_ID].join(',')))
|
|
|
})
|
|
|
bus.$event(Socket.LOGIN_RESPONSE, ([ret, user]) => {
|
|
|
if(ret === '1'){
|