From f2d317543872c2c5cd0d363ae171f4995d260f00 Mon Sep 17 00:00:00 2001 From: Adam Prins Date: Fri, 4 Jun 2021 07:52:16 -0400 Subject: [PATCH 1/2] change signup error from referencing Username to Email There is no field the user can see called username, So they were not clearly told it was the email that was causing the issue. --- api-js/src/locale/en/messages.js | 2 +- api-js/src/locale/fr/messages.js | 2 +- api-js/src/user/mutations/__tests__/sign-up.test.js | 4 ++-- api-js/src/user/mutations/sign-up.js | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api-js/src/locale/en/messages.js b/api-js/src/locale/en/messages.js index 46721e03f..e6ba56642 100644 --- a/api-js/src/locale/en/messages.js +++ b/api-js/src/locale/en/messages.js @@ -499,7 +499,7 @@ 'User could not be queried.': 'User could not be queried.', 'User role was updated successfully.': 'User role was updated successfully.', - 'Username already in use.': 'Username already in use.', + 'Email already in use.': 'Email already in use.', 'Username not available, please try another.': 'Username not available, please try another.', 'You must provide a `first` or `last` value to properly paginate the `DKIMResults` connection.': diff --git a/api-js/src/locale/fr/messages.js b/api-js/src/locale/fr/messages.js index a7501236f..e21078361 100644 --- a/api-js/src/locale/fr/messages.js +++ b/api-js/src/locale/fr/messages.js @@ -260,7 +260,7 @@ 'Unable to verify unknown organization.': 'todo', 'User could not be queried.': 'todo', 'User role was updated successfully.': 'todo', - 'Username already in use.': 'todo', + 'Email already in use.': 'todo', 'Username not available, please try another.': 'todo', 'You must provide a `first` or `last` value to properly paginate the `DKIMResults` connection.': 'todo', diff --git a/api-js/src/user/mutations/__tests__/sign-up.test.js b/api-js/src/user/mutations/__tests__/sign-up.test.js index f646aecbe..be3eb4180 100644 --- a/api-js/src/user/mutations/__tests__/sign-up.test.js +++ b/api-js/src/user/mutations/__tests__/sign-up.test.js @@ -752,7 +752,7 @@ describe('testing user sign up', () => { signUp: { result: { code: 400, - description: 'Username already in use.', + description: 'Email already in use.', }, }, }, @@ -760,7 +760,7 @@ describe('testing user sign up', () => { expect(response).toEqual(error) expect(consoleOutput).toEqual([ - 'User: test.account@istio.actually.exists tried to sign up, however there is already an account in use with that username.', + 'User: test.account@istio.actually.exists tried to sign up, however there is already an email in use with that username.', ]) }) }) diff --git a/api-js/src/user/mutations/sign-up.js b/api-js/src/user/mutations/sign-up.js index de72db3d0..15e304256 100644 --- a/api-js/src/user/mutations/sign-up.js +++ b/api-js/src/user/mutations/sign-up.js @@ -97,12 +97,12 @@ export const signUp = new mutationWithClientMutationId({ if (typeof checkUser !== 'undefined') { console.warn( - `User: ${userName} tried to sign up, however there is already an account in use with that username.`, + `User: ${userName} tried to sign up, however there is already an account in use with that email.`, ) return { _type: 'error', code: 400, - description: i18n._(t`Username already in use.`), + description: i18n._(t`Email already in use.`), } } From 9d9d1c74038d55d3ad740733dd0f888a65523885 Mon Sep 17 00:00:00 2001 From: Adam Prins Date: Mon, 7 Jun 2021 11:51:58 -0400 Subject: [PATCH 2/2] update sign-up.test for new text --- api-js/src/user/mutations/__tests__/sign-up.test.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/api-js/src/user/mutations/__tests__/sign-up.test.js b/api-js/src/user/mutations/__tests__/sign-up.test.js index be3eb4180..7dd5dbef8 100644 --- a/api-js/src/user/mutations/__tests__/sign-up.test.js +++ b/api-js/src/user/mutations/__tests__/sign-up.test.js @@ -680,7 +680,7 @@ describe('testing user sign up', () => { ]) }) }) - describe('when the user name already in use', () => { + describe('when the user name (email) already in use', () => { beforeEach(async () => { await collections.users.save({ userName: 'test.account@istio.actually.exists', @@ -690,7 +690,7 @@ describe('testing user sign up', () => { emailValidated: false, }) }) - it('returns a user name already in use error', async () => { + it('returns an email already in use error', async () => { const response = await graphql( schema, ` @@ -760,7 +760,7 @@ describe('testing user sign up', () => { expect(response).toEqual(error) expect(consoleOutput).toEqual([ - 'User: test.account@istio.actually.exists tried to sign up, however there is already an email in use with that username.', + 'User: test.account@istio.actually.exists tried to sign up, however there is already an account in use with that email.', ]) }) }) @@ -1853,7 +1853,7 @@ describe('testing user sign up', () => { ]) }) }) - describe('when the user name already in use', () => { + describe('when the user name (email) already in use', () => { beforeEach(async () => { await collections.users.save({ userName: 'test.account@istio.actually.exists', @@ -1863,7 +1863,7 @@ describe('testing user sign up', () => { emailValidated: false, }) }) - it('returns a user name already in use error', async () => { + it('returns an email already in use error', async () => { const response = await graphql( schema, ` @@ -1933,7 +1933,7 @@ describe('testing user sign up', () => { expect(response).toEqual(error) expect(consoleOutput).toEqual([ - 'User: test.account@istio.actually.exists tried to sign up, however there is already an account in use with that username.', + 'User: test.account@istio.actually.exists tried to sign up, however there is already an account in use with that email.', ]) }) })