From 569cf925c489c953d9c895b3996541b98dc64cd3 Mon Sep 17 00:00:00 2001 From: Joel Thoms Date: Mon, 12 Jun 2017 21:54:55 -0700 Subject: [PATCH] add restrictions for username --- actions/user-registration/__tests__/index.tests.js | 6 +++--- actions/user-registration/__tests__/request.tests.js | 2 +- actions/user-registration/request.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/actions/user-registration/__tests__/index.tests.js b/actions/user-registration/__tests__/index.tests.js index 1ea400f..0bc8310 100644 --- a/actions/user-registration/__tests__/index.tests.js +++ b/actions/user-registration/__tests__/index.tests.js @@ -86,7 +86,7 @@ describe('user-registration', () => { pathParameters: { realm: 'realm' }, body: querystring.stringify({ client_id: 'client_id', - username: 'test@test.com', + username: 'username', email: 'test@test.com', }) } @@ -102,7 +102,7 @@ describe('user-registration', () => { pathParameters: { realm: 'invalid' }, body: querystring.stringify({ client_id: 'client_id', - username: 'test@test.com', + username: 'username', email: 'test@test.com', password: 'password' }) @@ -123,7 +123,7 @@ describe('user-registration', () => { pathParameters: { realm: 'realm' }, body: querystring.stringify({ client_id: 'client_id', - username: 'test@test.com', + username: 'username', email: 'test@test.com', password: 'password' }) diff --git a/actions/user-registration/__tests__/request.tests.js b/actions/user-registration/__tests__/request.tests.js index 03b34ab..48aa7a4 100644 --- a/actions/user-registration/__tests__/request.tests.js +++ b/actions/user-registration/__tests__/request.tests.js @@ -65,7 +65,7 @@ describe('userRegistrationRequest', () => { pathParameters: { realm: 'realm' }, body: querystring.encode({ client_id: 'client_id', - username: 'email@address.com', + username: 'username', email: 'test@test.com', }) } diff --git a/actions/user-registration/request.js b/actions/user-registration/request.js index b40372b..d7401c0 100644 --- a/actions/user-registration/request.js +++ b/actions/user-registration/request.js @@ -12,7 +12,7 @@ const getRequest = event => const schema = Joi.object().keys({ realm: Joi.string().required(), client_id: Joi.string().required(), - username: Joi.string().required(), + username: Joi.string().alphanum().min(4).max(30).required(), email: Joi.string().email().required(), password: Joi.string().required(), redirect_uri: Joi.string()