diff --git a/src/router.js b/src/router.js index c37f450f..09f5a4b9 100644 --- a/src/router.js +++ b/src/router.js @@ -50,10 +50,13 @@ const redirectToLoginRequest = (to, from, next) => { const clientId = query.client_id; delete query.client_id; let scope = 'posting'; - if (query.scope.includes('login')) scope = 'login'; - if (query.scope.includes('offline')) scope = 'offline'; + if (query.scope === 'login') scope = 'login'; + if (query.scope && query.scope.includes('offline')) { + scope = 'posting'; + query.response_type = 'code'; + } query.scope = scope; - next({ name: 'login-request-app', params: { clientId }, query: to.query }); + next({ name: 'login-request-app', params: { clientId }, query }); }; export default new Router({ diff --git a/src/store/modules/auth.js b/src/store/modules/auth.js index 6c73438f..6876ea29 100644 --- a/src/store/modules/auth.js +++ b/src/store/modules/auth.js @@ -67,8 +67,11 @@ const actions = { const timestamp = parseInt(new Date().getTime() / 1000, 10); const messageObj = { signed_message: message, authors: [username], timestamp }; const hash = cryptoUtils.sha256(JSON.stringify(messageObj)); - const key = privateKeyFrom(keys[authority]); - const signature = key.sign(hash).toString(); + const privateKey = + authority && keys[authority] + ? privateKeyFrom(keys[authority]) + : privateKeyFrom(keys.active || keys.posting || keys.memo); + const signature = privateKey.sign(hash).toString(); messageObj.signatures = [signature]; return messageObj; }, diff --git a/src/views/Import.vue b/src/views/Import.vue index 76ea4a5e..d6dc0911 100644 --- a/src/views/Import.vue +++ b/src/views/Import.vue @@ -55,8 +55,8 @@ class="tooltipped tooltipped-n tooltipped-multiline" :aria-label="TOOLTIP_IMPORT_ENCRYPTION_KEY" > - - + +