From 314670eafde44536a5d65fb9ededba34c30abb61 Mon Sep 17 00:00:00 2001 From: Cindy Chang Date: Tue, 11 Jun 2024 12:23:17 +0800 Subject: [PATCH] fix #216. Add base5 encode. Also add cypress. --- cypress/e2e/pasteUrlLoginRedirect.cy.js | 17 +++++++++++++++++ src/stores/login.js | 4 +--- 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 cypress/e2e/pasteUrlLoginRedirect.cy.js diff --git a/cypress/e2e/pasteUrlLoginRedirect.cy.js b/cypress/e2e/pasteUrlLoginRedirect.cy.js new file mode 100644 index 0000000..94e2846 --- /dev/null +++ b/cypress/e2e/pasteUrlLoginRedirect.cy.js @@ -0,0 +1,17 @@ +const urlUnderTest = `https://REDACTED-HOST/login?return-to=aHR0cHM6Ly9sdWNpYS1kZXYuZHNwLmltL2Rpc2NvdmVyL2NvbmZvcm1hbmNlL2xvZy8xODU1MjQ3OTcvY29uZm9ybWFuY2U=`; +describe('Conformance', ()=>{ + beforeEach(() => { + cy.visit(urlUnderTest); + }); + + it('After pasting discover/conformance/log/ page, frontend should redirect to corresponding\ + page, not login page', () => { + cy.get('#account').clear().type(` ${Cypress.env('user').username} `); + cy.get('#password').clear().type(` ${Cypress.env('user').password} `); + cy.get('.btn-lg').click(); + cy.get('form').submit(); + + cy.contains('Conformance Checking Results').should('be.visible'); + }) + + }); diff --git a/src/stores/login.js b/src/stores/login.js index ea74501..f7ecb6a 100644 --- a/src/stores/login.js +++ b/src/stores/login.js @@ -46,10 +46,8 @@ export default defineStore('loginStore', { // 然而有一種情況是使用者在沒有登入的情況下貼上了某一個頁面的網址, // 則在此情況下時,我們會在使用者稍後登入後,把使用者帶到剛才記住的 return-to 網址 if(this.rememberedReturnToUrl !== "") { - console.log('1111', ); - window.location.href = this.rememberedReturnToUrl; + window.location.href = atob(this.rememberedReturnToUrl); } else { - console.log('2222', ); this.$router.push('/login'); } } catch(error) {