From 9e2baf25d2a607338b3e0c7889f799d1cd472709 Mon Sep 17 00:00:00 2001 From: roschaefer Date: Thu, 28 Nov 2019 11:18:14 +0100 Subject: [PATCH] Don't remove dots in emails --- backend/src/schema/resolvers/emails.js | 2 +- .../schema/resolvers/helpers/createPasswordReset.js | 2 +- backend/src/schema/resolvers/helpers/normalizeEmail.js | 10 ++++++++++ backend/src/schema/resolvers/registration.js | 2 +- backend/src/schema/resolvers/user_management.js | 2 +- webapp/components/PasswordReset/Request.vue | 2 +- webapp/components/utils/NormalizeEmail.js | 10 ++++++++++ webapp/pages/admin/users.vue | 3 ++- webapp/pages/settings/my-email-address/index.vue | 2 +- 9 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 backend/src/schema/resolvers/helpers/normalizeEmail.js create mode 100644 webapp/components/utils/NormalizeEmail.js diff --git a/backend/src/schema/resolvers/emails.js b/backend/src/schema/resolvers/emails.js index 06c0dbd1a..8711a5996 100644 --- a/backend/src/schema/resolvers/emails.js +++ b/backend/src/schema/resolvers/emails.js @@ -3,7 +3,7 @@ import Resolver from './helpers/Resolver' import existingEmailAddress from './helpers/existingEmailAddress' import { UserInputError } from 'apollo-server' import Validator from 'neode/build/Services/Validator.js' -import { normalizeEmail } from 'validator' +import normalizeEmail from './helpers/normalizeEmail' export default { Mutation: { diff --git a/backend/src/schema/resolvers/helpers/createPasswordReset.js b/backend/src/schema/resolvers/helpers/createPasswordReset.js index 8d575abfc..d73cfaa81 100644 --- a/backend/src/schema/resolvers/helpers/createPasswordReset.js +++ b/backend/src/schema/resolvers/helpers/createPasswordReset.js @@ -1,4 +1,4 @@ -import { normalizeEmail } from 'validator' +import normalizeEmail from './normalizeEmail' export default async function createPasswordReset(options) { const { driver, nonce, email, issuedAt = new Date() } = options diff --git a/backend/src/schema/resolvers/helpers/normalizeEmail.js b/backend/src/schema/resolvers/helpers/normalizeEmail.js new file mode 100644 index 000000000..da190085c --- /dev/null +++ b/backend/src/schema/resolvers/helpers/normalizeEmail.js @@ -0,0 +1,10 @@ +import { normalizeEmail } from 'validator' + +export default (email) => normalizeEmail(email, { + gmail_remove_dots: false, + gmail_remove_subaddress: false, + // gmail_convert_googlemaildotcom: true, default + outlookdotcom_remove_subaddress: false, + yahoo_remove_subaddress: false, + icloud_remove_subaddress: false, +}) diff --git a/backend/src/schema/resolvers/registration.js b/backend/src/schema/resolvers/registration.js index d425357c3..639c607b7 100644 --- a/backend/src/schema/resolvers/registration.js +++ b/backend/src/schema/resolvers/registration.js @@ -4,7 +4,7 @@ import fileUpload from './fileUpload' import encryptPassword from '../../helpers/encryptPassword' import generateNonce from './helpers/generateNonce' import existingEmailAddress from './helpers/existingEmailAddress' -import { normalizeEmail } from 'validator' +import normalizeEmail from './helpers/normalizeEmail' const instance = neode() diff --git a/backend/src/schema/resolvers/user_management.js b/backend/src/schema/resolvers/user_management.js index b7584dd68..81550d8cf 100644 --- a/backend/src/schema/resolvers/user_management.js +++ b/backend/src/schema/resolvers/user_management.js @@ -2,7 +2,7 @@ import encode from '../../jwt/encode' import bcrypt from 'bcryptjs' import { AuthenticationError } from 'apollo-server' import { neode } from '../../bootstrap/neo4j' -import { normalizeEmail } from 'validator' +import normalizeEmail from './helpers/normalizeEmail' const instance = neode() diff --git a/webapp/components/PasswordReset/Request.vue b/webapp/components/PasswordReset/Request.vue index 1cf575574..30b86e8c2 100644 --- a/webapp/components/PasswordReset/Request.vue +++ b/webapp/components/PasswordReset/Request.vue @@ -46,7 +46,7 @@