diff --git a/admin/.env.dist b/admin/.env.dist index 9d9a6fc4c..1419552be 100644 --- a/admin/.env.dist +++ b/admin/.env.dist @@ -1,4 +1,4 @@ GRAPHQL_URI=http://localhost:4000/graphql -WALLET_AUTH_URL=http://localhost/authenticate?token=$1 +WALLET_AUTH_URL=http://localhost/authenticate?token=$token WALLET_URL=http://localhost/login DEBUG_DISABLE_AUTH=false \ No newline at end of file diff --git a/admin/src/components/NavBar.vue b/admin/src/components/NavBar.vue index c1c315755..12936f554 100644 --- a/admin/src/components/NavBar.vue +++ b/admin/src/components/NavBar.vue @@ -38,7 +38,7 @@ export default { this.$store.dispatch('logout') }, wallet() { - window.location = CONFIG.WALLET_AUTH_URL.replace('$1', this.$store.state.token) + window.location = CONFIG.WALLET_AUTH_URL.replace('$token', this.$store.state.token) this.$store.dispatch('logout') // logout without redirect }, }, diff --git a/admin/src/config/index.js b/admin/src/config/index.js index 5bcf7938b..6e338fe9c 100644 --- a/admin/src/config/index.js +++ b/admin/src/config/index.js @@ -19,7 +19,7 @@ const environment = { const endpoints = { GRAPHQL_URI: process.env.GRAPHQL_URI || 'http://localhost:4000/graphql', - WALLET_AUTH_URL: process.env.WALLET_AUTH_URL || 'http://localhost/authenticate?token=$1', + WALLET_AUTH_URL: process.env.WALLET_AUTH_URL || 'http://localhost/authenticate?token=$token', WALLET_URL: process.env.WALLET_URL || 'http://localhost/login', } diff --git a/backend/.env.dist b/backend/.env.dist index 77fd9f6cc..1238d0f81 100644 --- a/backend/.env.dist +++ b/backend/.env.dist @@ -19,7 +19,8 @@ DB_DATABASE=gradido_community #RESEND_TIME= RESEND_TIME=10 -#EMAIL_LINK_VERIFICATION=http://localhost/checkEmail/$1 +#EMAIL_LINK_VERIFICATION=http://localhost/checkEmail/$code +#EMAIL_LINK_SETPASSWORD=http://localhost/reset/$code #KLICKTIPP_USER= #KLICKTIPP_PASSWORD= diff --git a/backend/.env.template b/backend/.env.template index 8611e93cf..a1cc3eb6b 100644 --- a/backend/.env.template +++ b/backend/.env.template @@ -19,6 +19,7 @@ EMAIL_SMTP_PORT=587 RESEND_TIME=10 EMAIL_LINK_VERIFICATION=$EMAIL_LINK_VERIFICATION +EMAIL_LINK_SETPASSWORD=$EMAIL_LINK_SETPASSWORD #KLICKTIPP_USER= #KLICKTIPP_PASSWORD= diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts index 8e1218f12..9306b2867 100644 --- a/backend/src/config/index.ts +++ b/backend/src/config/index.ts @@ -50,8 +50,9 @@ const email = { EMAIL_PASSWORD: process.env.EMAIL_PASSWORD || 'xxx', EMAIL_SMTP_URL: process.env.EMAIL_SMTP_URL || 'gmail.com', EMAIL_SMTP_PORT: process.env.EMAIL_SMTP_PORT || '587', - EMAIL_LINK_VERIFICATION: process.env.EMAIL_LINK_VERIFICATION || 'http://localhost/checkEmail/$1', - EMAIL_LINK_SETPASSWORD: process.env.EMAIL_LINK_SETPASSWORD || 'http://localhost/reset/$1', + EMAIL_LINK_VERIFICATION: + process.env.EMAIL_LINK_VERIFICATION || 'http://localhost/checkEmail/$code', + EMAIL_LINK_SETPASSWORD: process.env.EMAIL_LINK_SETPASSWORD || 'http://localhost/reset/$code', RESEND_TIME: isNaN(resendTime) ? 10 : resendTime, } diff --git a/backend/src/graphql/resolver/UserResolver.test.ts b/backend/src/graphql/resolver/UserResolver.test.ts index 1f0bce30f..e5b7b9221 100644 --- a/backend/src/graphql/resolver/UserResolver.test.ts +++ b/backend/src/graphql/resolver/UserResolver.test.ts @@ -162,7 +162,7 @@ describe('UserResolver', () => { describe('account activation email', () => { it('sends an account activation email', () => { - const activationLink = CONFIG.EMAIL_LINK_VERIFICATION.replace(/\$1/g, emailOptIn) + const activationLink = CONFIG.EMAIL_LINK_VERIFICATION.replace(/\$code/g, emailOptIn) expect(sendAccountActivationEmail).toBeCalledWith({ link: activationLink, firstName: 'Peter', diff --git a/backend/src/graphql/resolver/UserResolver.ts b/backend/src/graphql/resolver/UserResolver.ts index b751eb633..e0afe1d19 100644 --- a/backend/src/graphql/resolver/UserResolver.ts +++ b/backend/src/graphql/resolver/UserResolver.ts @@ -448,7 +448,7 @@ export class UserResolver { const emailOptIn = await createEmailOptIn(loginUserId, queryRunner) const activationLink = CONFIG.EMAIL_LINK_VERIFICATION.replace( - /\$1/g, + /\$code/g, emailOptIn.verificationCode.toString(), ) const emailSent = await sendAccountActivationEmail({ @@ -486,7 +486,7 @@ export class UserResolver { const emailOptIn = await createEmailOptIn(loginUser.id, queryRunner) const activationLink = CONFIG.EMAIL_LINK_VERIFICATION.replace( - /\$1/g, + /\$code/g, emailOptIn.verificationCode.toString(), ) @@ -523,7 +523,7 @@ export class UserResolver { const optInCode = await getOptInCode(loginUser) const link = CONFIG.EMAIL_LINK_SETPASSWORD.replace( - /\$1/g, + /\$code/g, optInCode.verificationCode.toString(), ) diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index 9eaa2a0ed..322be071d 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -21,14 +21,15 @@ EMAIL_USERNAME=peter@lustig.de EMAIL_SENDER=peter@lustig.de EMAIL_PASSWORD=1234 EMAIL_SMTP_URL=smtp.lustig.de -EMAIL_LINK_VERIFICATION=https://stage1.gradido.net/checkEmail/$1 +EMAIL_LINK_VERIFICATION=https://stage1.gradido.net/checkEmail/$code +EMAIL_LINK_SETPASSWORD=http://stage1.gradido.net/reset/$code WEBHOOK_ELOPAGE_SECRET=secret # frontend GRAPHQL_URI=https://stage1.gradido.net/graphql -ADMIN_AUTH_URL=https://stage1.gradido.net/admin/authenticate?token=$1 +ADMIN_AUTH_URL=https://stage1.gradido.net/admin/authenticate?token=$token # admin -WALLET_AUTH_URL=https://stage1.gradido.net/authenticate?token=$1 +WALLET_AUTH_URL=https://stage1.gradido.net/authenticate?token=$token WALLET_URL=https://stage1.gradido.net/login \ No newline at end of file diff --git a/frontend/.env.dist b/frontend/.env.dist index 3602c4dd2..212290f2d 100644 --- a/frontend/.env.dist +++ b/frontend/.env.dist @@ -1,3 +1,3 @@ GRAPHQL_URI=http://localhost/graphql DEFAULT_PUBLISHER_ID=2896 -ADMIN_AUTH_URL=http://localhost/admin/authenticate?token=$1 \ No newline at end of file +ADMIN_AUTH_URL=http://localhost/admin/authenticate?token=$token \ No newline at end of file diff --git a/frontend/src/config/index.js b/frontend/src/config/index.js index 000d5fb37..73ce85fa3 100644 --- a/frontend/src/config/index.js +++ b/frontend/src/config/index.js @@ -20,7 +20,7 @@ const environment = { const endpoints = { GRAPHQL_URI: process.env.GRAPHQL_URI || 'http://localhost/graphql', - ADMIN_AUTH_URL: process.env.ADMIN_AUTH_URL || 'http://localhost/admin/authenticate?token=$1', + ADMIN_AUTH_URL: process.env.ADMIN_AUTH_URL || 'http://localhost/admin/authenticate?token=$token', } const options = {} diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.vue b/frontend/src/views/Layout/DashboardLayout_gdd.vue index bd3bd8e4c..d26d9325e 100755 --- a/frontend/src/views/Layout/DashboardLayout_gdd.vue +++ b/frontend/src/views/Layout/DashboardLayout_gdd.vue @@ -108,7 +108,7 @@ export default { this.balance -= ammount }, admin() { - window.location.assign(CONFIG.ADMIN_AUTH_URL.replace('$1', this.$store.state.token)) + window.location.assign(CONFIG.ADMIN_AUTH_URL.replace('$token', this.$store.state.token)) this.$store.dispatch('logout') // logout without redirect }, setVisible(bool) {