From 3b0baa4fc54b87c761461411734f7ff96c9001bf Mon Sep 17 00:00:00 2001 From: William Lee <43682783+wlee221@users.noreply.github.com> Date: Mon, 1 Feb 2021 15:40:47 -0800 Subject: [PATCH] fix(@aws-amplify/ui-components): handle non-username alias (#7663) --- .../src/components/amplify-sign-up/amplify-sign-up.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/amplify-ui-components/src/components/amplify-sign-up/amplify-sign-up.tsx b/packages/amplify-ui-components/src/components/amplify-sign-up/amplify-sign-up.tsx index 055b39ea8a5..963bd293c79 100644 --- a/packages/amplify-ui-components/src/components/amplify-sign-up/amplify-sign-up.tsx +++ b/packages/amplify-ui-components/src/components/amplify-sign-up/amplify-sign-up.tsx @@ -133,6 +133,9 @@ export class AmplifySignUp { break; } try { + if (!this.signUpAttributes.username) { + throw new Error(Translations.EMPTY_USERNAME); + } if (this.signUpAttributes.username.indexOf(' ') >= 0) { throw new Error(Translations.USERNAME_REMOVE_WHITESPACE); }