Merge pull request #4336 from Ocelot-Social-Community/fix-invite-registration

fix: Email Confirmation-Link When An Invite-Code Is Given
This commit is contained in:
Wolfgang Huß 2021-04-06 17:18:39 +02:00 committed by GitHub
commit 8e479401a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 79 additions and 26 deletions

View File

@ -4,8 +4,17 @@ All notable changes to this project will be documented in this file. Dates are d
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
#### [v1.0.1](https://github.com/Ocelot-Social-Community/Ocelot-Social/compare/1.0.0...v1.0.1)
#### [v1.0.2](https://github.com/Ocelot-Social-Community/Ocelot-Social/compare/1.0.1...v1.0.2)
- slider jumps to enter-nonce when link contains invite-code, email and nonce and method is invite-code. Thanks @tirokk [`c80b3a2`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/c80b3a212835f76cfc2f11542345d6c3b226995b)
- fix enail confirmation link when an invite-code is given [`27f0de9`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/27f0de9464685c8f960bde9d07986fdc5b20f8f9)
- linting [`21a667e`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/21a667eb25a236c69f69b61f24d1578ea005a910)
#### [1.0.1](https://github.com/Ocelot-Social-Community/Ocelot-Social/compare/1.0.0...1.0.1)
> 4 April 2021
- readme_update [`#4331`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/4331)
- jwt_expiretime [`#4330`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/4330)
- Clean env, docker & workflow [`#4337`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/4337)
- fix: 🍰 Fixing The Avatars unwanted Border [`#4320`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/4320)
@ -127,11 +136,21 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- file upload: refactored [`650e83f`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/650e83f4c250389477933a2e7d21d8245b0ce882)
- change user role: tests are working [`14dfe2a`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/14dfe2ae2cd4a24c06c9229893b33586dfceae4f)
#### [0.6.5](https://github.com/Ocelot-Social-Community/Ocelot-Social/compare/0.6.4...0.6.5)
#### [0.6.5](https://github.com/Ocelot-Social-Community/Ocelot-Social/compare/v0.6.4...0.6.5)
> 8 February 2021
- updated CHANGELOG.md [`9d9075f`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/9d9075f2117b2eb4b607e7d59ab18c7e655c6ea7)
- - adjusted changelog to ocelot-social repo [`9603882`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/9603882edebf8967e05abfa94e4e1ebf452d4e24)
- - first steps towards docker image deployment & github autotagging [`5503216`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/5503216ad4a0230ac533042e4a69806590fc2a5a)
- - deploy structure image [`a60400b`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/a60400b4fe6f59bbb80e1073db4def3ba205e1a7)
#### [v0.6.4](https://github.com/Ocelot-Social-Community/Ocelot-Social/compare/0.6.4...v0.6.4)
> 9 February 2021
- chore(release): 0.6.4 [`8b7570d`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/8b7570dc35d0ea431f673a711ac051f1e1320acb)
- change user roles is working, test fails [`8c3310a`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/8c3310abaf87c0e5597fec4f93fb37d27122c9e7)
- change user role: tests are working [`f10da4b`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/f10da4b09388fe1e2b85abd53f6ffc67c785d4c1)
#### [0.6.4](https://github.com/Ocelot-Social-Community/Ocelot-Social/compare/0.6.3...0.6.4)
@ -141,7 +160,15 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- fetch full history [`5ecee4d`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/5ecee4d73a92d2e5c5ae971d79848ed27f65a72c)
- don't fail if tag exists (release) [`39c82fc`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/39c82fcb37d5c8e7e78a79288e1ef6280f8d0892)
#### [0.6.3](https://github.com/Ocelot-Social-Community/Ocelot-Social/compare/0.6.0...0.6.3)
#### [0.6.3](https://github.com/Ocelot-Social-Community/Ocelot-Social/compare/v0.6.3...0.6.3)
> 8 February 2021
- - adjusted changelog to ocelot-social repo [`9603882`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/9603882edebf8967e05abfa94e4e1ebf452d4e24)
- - fixed changelog [`cf70b12`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/cf70b12ed74011924ea788ab932fc9d7ac0e6bd9)
- - yarn install to allow yarn auto-changelog [`fc496aa`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/fc496aa04cb7e804da4335da0cb5cda26f874ea2)
#### [v0.6.3](https://github.com/Ocelot-Social-Community/Ocelot-Social/compare/0.6.0...v0.6.3)
> 8 February 2021
@ -150,9 +177,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- feat: 🍰 Allow Only Supported Image File Formats [`#3928`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/3928)
- refactor: Disbale Emoji, Language And Catgeory Filter [`#4193`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/4193)
- refactor: Remove Catgeories From Post Teaser [`#4191`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/4191)
- - adjusted changelog to ocelot-social repo [`9603882`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/9603882edebf8967e05abfa94e4e1ebf452d4e24)
- - first steps towards docker image deployment & github autotagging [`5503216`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/5503216ad4a0230ac533042e4a69806590fc2a5a)
- - lots of additional tests [`0ba37aa`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/0ba37aab18f537d722aede7b87fa0b8e79f80e66)
- - deploy structure image [`a60400b`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/a60400b4fe6f59bbb80e1073db4def3ba205e1a7)
#### [0.6.0](https://github.com/Ocelot-Social-Community/Ocelot-Social/compare/v0.6.0...0.6.0)

View File

@ -1,6 +1,6 @@
{
"name": "ocelot-social-backend",
"version": "1.0.1",
"version": "1.0.2",
"description": "GraphQL Backend for ocelot.social",
"repository": "https://github.com/Ocelot-Social-Community/Ocelot-Social",
"author": "ocelot.social Community",

View File

@ -43,9 +43,14 @@ if (!hasEmailConfig) {
}
const sendSignupMail = async (resolve, root, args, context, resolveInfo) => {
const { inviteCode } = args
const response = await resolve(root, args, context, resolveInfo)
const { email, nonce } = response
await sendMail(signupTemplate({ email, nonce }))
if (inviteCode) {
await sendMail(signupTemplate({ email, nonce, inviteCode }))
} else {
await sendMail(signupTemplate({ email, nonce }))
}
delete response.nonce
return response
}

View File

@ -13,13 +13,18 @@ const defaultParams = {
welcomeImageUrl,
}
export const signupTemplate = ({ email, nonce }) => {
export const signupTemplate = ({ email, nonce, inviteCode = null }) => {
const subject = `Willkommen, Bienvenue, Welcome to ${CONFIG.APPLICATION_NAME}!`
// dev format example: http://localhost:3000/registration?method=invite-mail&email=wolle.huss%40pjannto.com&nonce=64853
const actionUrl = new URL('/registration', CONFIG.CLIENT_URI)
actionUrl.searchParams.set('method', 'invite-mail')
actionUrl.searchParams.set('email', email)
actionUrl.searchParams.set('nonce', nonce)
if (inviteCode) {
actionUrl.searchParams.set('inviteCode', inviteCode)
actionUrl.searchParams.set('method', 'invite-code')
} else {
actionUrl.searchParams.set('method', 'invite-mail')
}
return {
from,

View File

@ -7,8 +7,8 @@
<td style="background-color: #ffffff;">
<img
src="{{{ welcomeImageUrl }}}"
width="600" height="" alt="Welcome image" border="0"
style="width: 100%; max-width: 600px; height: auto; background: #ffffff; font-family: Lato, sans-serif; font-size: 16px; line-height: 15px; color: #555555; margin: auto; display: block;"
width="300" height="" alt="Welcome image" border="0"
style="width: 100%; max-width: 300px; height: auto; background: #ffffff; font-family: Lato, sans-serif; font-size: 16px; line-height: 15px; color: #555555; margin: auto; display: block; padding: 20px;"
class="g-img">
</td>
</tr>
@ -118,8 +118,8 @@
<td style="background-color: #ffffff;">
<img
src="{{{ welcomeImageUrl }}}"
width="600" height="" alt="Welcome image" border="0"
style="width: 100%; max-width: 600px; height: auto; background: #ffffff; font-family: Lato, sans-serif; font-size: 16px; line-height: 15px; color: #555555; margin: auto; display: block;"
width="300" height="" alt="Welcome image" border="0"
style="width: 100%; max-width: 300px; height: auto; background: #ffffff; font-family: Lato, sans-serif; font-size: 16px; line-height: 15px; color: #555555; margin: auto; display: block; padding: 20px;"
class="g-img">
</td>
</tr>

View File

@ -72,10 +72,10 @@ const signupCypher = (inviteCode) => {
(inviteCode:InviteCode {code: $inviteCode})<-[:GENERATED]-(host:User)
`
optionalMerge = `
MERGE(user)-[:REDEEMED]->(inviteCode)
MERGE(host)-[:INVITED]->(user)
MERGE(user)-[:FOLLOWS]->(host)
MERGE(host)-[:FOLLOWS]->(user)
MERGE(user)-[:REDEEMED { createdAt: toString(datetime()) }]->(inviteCode)
MERGE(host)-[:INVITED { createdAt: toString(datetime()) }]->(user)
MERGE(user)-[:FOLLOWS { createdAt: toString(datetime()) }]->(host)
MERGE(host)-[:FOLLOWS { createdAt: toString(datetime()) }]->(user)
`
}
const cypher = `

View File

@ -1,6 +1,6 @@
{
"name": "ocelot-social",
"version": "1.0.1",
"version": "1.0.2",
"description": "Fullstack and API tests with cypress and cucumber for ocelot.social",
"author": "ocelot.social Community",
"license": "MIT",

View File

@ -67,6 +67,7 @@ export default {
props: {
registrationType: { type: String, required: true },
overwriteSliderData: { type: Object, default: () => {} },
activePage: { type: String, default: null, required: false },
},
data() {
const slidersPortfolio = {
@ -172,7 +173,8 @@ export default {
termsAndConditionsConfirmed: null,
recieveCommunicationAsEmailsEtcConfirmed: null,
},
sliderIndex: 0,
sliderIndex:
this.activePage === null ? 0 : sliders.findIndex((el) => el.name === this.activePage),
sliders: sliders,
sliderSelectorCallback: this.sliderSelectorCallback,
setSliderValuesCallback: this.setSliderValuesCallback,

View File

@ -1,6 +1,6 @@
{
"name": "ocelot-social-webapp",
"version": "1.0.1",
"version": "1.0.2",
"description": "ocelot.social Frontend",
"repository": "https://github.com/Ocelot-Social-Community/Ocelot-Social",
"author": "ocelot.social Community",

View File

@ -1,6 +1,7 @@
<template>
<registration-slider
:registrationType="registrationType"
:registrationType="registrationType.method"
:activePage="registrationType.activePage"
:overwriteSliderData="overwriteSliderData"
/>
</template>
@ -39,18 +40,31 @@ export default {
registrationType() {
if (!this.method) {
return (
(this.publicRegistration && 'public-registration') ||
(this.inviteRegistration && 'invite-code') ||
'no-public-registration'
(this.publicRegistration && { method: 'public-registration', activePage: null }) ||
(this.inviteRegistration && { method: 'invite-code', activePage: null }) || {
method: 'no-public-registration',
activePage: null,
}
)
} else {
if (
this.method === 'invite-mail' ||
(this.method === 'invite-code' && this.inviteRegistration)
) {
return this.method
if (
this.method === 'invite-code' &&
this.overwriteSliderData.collectedInputData.inviteCode &&
this.overwriteSliderData.collectedInputData.nonce &&
this.overwriteSliderData.collectedInputData.email
) {
return { method: this.method, activePage: 'enter-nonce' }
}
return { method: this.method, activePage: null }
}
return {
method: this.publicRegistration ? 'public-registration' : 'no-public-registration',
activePage: null,
}
return this.publicRegistration ? 'public-registration' : 'no-public-registration'
}
},
},