Open qz1543706741 opened 2 years ago
建议修改: /lib/auth/index.js
/lib/auth/index.js
debug('Auth: encryptedData: %s, iv: %s', encryptedData, iv) // 获取 session key return getSessionKey(code) .then(pkg => { const { session_key, openid } = pkg // 生成 3rd_session const skey = sha1(session_key) // 解密数据 let decryptedData try { decryptedData = aesDecrypt(session_key, iv, encryptedData) decryptedData = JSON.parse(decryptedData) } catch (e) { debug('Auth: %s: %o', ERRORS.ERR_IN_DECRYPT_DATA, e) throw new Error(`${ERRORS.ERR_IN_DECRYPT_DATA}\n${e}`) } // 存储到数据库中 return AuthDbService.saveUserInfo(Object.assign(decryptedData, {openId: openid}) , skey, session_key).then(userinfo => ({ loginState: LOGIN_STATE.SUCCESS, userinfo })) })
建议修改:
/lib/auth/index.js