From 07e23d8a17de89125fbf77f61b72434cf6d304ab Mon Sep 17 00:00:00 2001 From: Guillaume Vincent Date: Mon, 20 Dec 2021 10:14:23 +0100 Subject: [PATCH] Change root url used in the copy password profile button --- packages/lesspass-pure/package.json | 2 +- packages/lesspass-pure/src/store/getters.js | 3 ++- packages/lesspass-pure/tests/unit/store/getters.spec.js | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/lesspass-pure/package.json b/packages/lesspass-pure/package.json index 5ad21da..635ac6b 100644 --- a/packages/lesspass-pure/package.json +++ b/packages/lesspass-pure/package.json @@ -1,6 +1,6 @@ { "name": "lesspass-pure", - "version": "9.5.2", + "version": "9.5.3", "description": "LessPass web component", "license": "GPL-3.0", "author": "Guillaume Vincent ", diff --git a/packages/lesspass-pure/src/store/getters.js b/packages/lesspass-pure/src/store/getters.js index 7557010..1d0f3ef 100644 --- a/packages/lesspass-pure/src/store/getters.js +++ b/packages/lesspass-pure/src/store/getters.js @@ -7,7 +7,8 @@ export const isGuest = state => !state.isAuthenticated; export const passwordURL = state => { const base64PasswordProfile = btoa(JSON.stringify(state.password)); const encodedPasswordProfile = encodeURIComponent(base64PasswordProfile); - return `${state.settings.baseURL}/#/?passwordProfileEncoded=${encodedPasswordProfile}`; + const wwwBaseUrl = state.settings.baseURL.replace('api.', 'www.'); + return `${wwwBaseUrl}/#/?passwordProfileEncoded=${encodedPasswordProfile}`; }; export const shouldAutoFillSite = state => !state.settings.noAutoFillSite; diff --git a/packages/lesspass-pure/tests/unit/store/getters.spec.js b/packages/lesspass-pure/tests/unit/store/getters.spec.js index c9fbf4b..9c76e84 100644 --- a/packages/lesspass-pure/tests/unit/store/getters.spec.js +++ b/packages/lesspass-pure/tests/unit/store/getters.spec.js @@ -19,7 +19,7 @@ test("passwordURL", () => { }; expect(getters.passwordURL(state)).toBe( - "https://api.lesspass.com/#/?passwordProfileEncoded=eyJsb2dpbiI6InRlc3RAZXhhbXBsZS5vcmciLCJzaXRlIjoiZXhhbXBsZS5vcmciLCJ1cHBlcmNhc2UiOnRydWUsImxvd2VyY2FzZSI6dHJ1ZSwibnVtYmVycyI6dHJ1ZSwic3ltYm9scyI6ZmFsc2UsImxlbmd0aCI6MTYsImNvdW50ZXIiOjEsInZlcnNpb24iOjJ9" + "https://www.lesspass.com/#/?passwordProfileEncoded=eyJsb2dpbiI6InRlc3RAZXhhbXBsZS5vcmciLCJzaXRlIjoiZXhhbXBsZS5vcmciLCJ1cHBlcmNhc2UiOnRydWUsImxvd2VyY2FzZSI6dHJ1ZSwibnVtYmVycyI6dHJ1ZSwic3ltYm9scyI6ZmFsc2UsImxlbmd0aCI6MTYsImNvdW50ZXIiOjEsInZlcnNpb24iOjJ9" ); }); @@ -34,7 +34,7 @@ test("passwordURL encode uri component", () => { }; expect(getters.passwordURL(state)).toBe( - "https://api.lesspass.com/#/?passwordProfileEncoded=eyJsb2dpbiI6ImNvbnRhY3RAbGVzc3Bhc3MuY29tIn0%3D" + "https://www.lesspass.com/#/?passwordProfileEncoded=eyJsb2dpbiI6ImNvbnRhY3RAbGVzc3Bhc3MuY29tIn0%3D" ); });