From 6ffafff2880ed599fe1081d2db28937c67e4bbac Mon Sep 17 00:00:00 2001 From: roschaefer Date: Wed, 2 Oct 2019 01:31:23 +0200 Subject: [PATCH] fix: ensure no other user owns a new email address `BELONGS_TO` means a user owns an email address. `PRIMARY_EMAIL` means a user authenticates with that email. So right now, you get a proper error message if you try to change your email back to your old email address (because you own it already). I will make sure to delete the old email so this will be no problem anymore. But maybe in the future we might have multiple email addresses per user and then it makes a big difference to use `PRIMARY_EMAIL` or `BELONGS_TO`. --- backend/src/schema/resolvers/helpers/existingEmailAddress.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/schema/resolvers/helpers/existingEmailAddress.js b/backend/src/schema/resolvers/helpers/existingEmailAddress.js index d05122df1..007d2de6b 100644 --- a/backend/src/schema/resolvers/helpers/existingEmailAddress.js +++ b/backend/src/schema/resolvers/helpers/existingEmailAddress.js @@ -4,7 +4,7 @@ export default async function alreadyExistingMail(_parent, args, context) { email = email.toLowerCase() const cypher = ` MATCH (email:EmailAddress {email: $email}) - OPTIONAL MATCH (email)-[:PRIMARY_EMAIL]-(user) + OPTIONAL MATCH (email)-[:BELONGS_TO]-(user) RETURN email, user ` let transactionRes