Fixed user creation with empty password
MODIFY
src/assets/server/rest/v1/schemas/common/common.json
src/assets/server/rest/v1/schemas/common/common.json
},
"password": {
"type": "string",
- "sanitize": "mongo"
+ "sanitize": "mongo",
+ "pattern": "(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!#@:;,<>\/''\\$%\\^&\\*\\.\\?\\-_\\+\\=\\(\\)])(?=.{8,})"
},
"captcha": {
"type": "string",

MODIFY
test/api/AuthenticationTest.ts
test/api/AuthenticationTest.ts
@@ -233,12 +233,20 @@ describe('Authentication Service (tenant utall)', function() {
describe('Error cases', () => {
it('Should not allow authentication of known user with wrong password', async () => {
// Call
- const response = await CentralServerService.defaultInstance.authenticationApi.login(testData.adminEmail, 'another', true);
+ const response = await CentralServerService.defaultInstance.authenticationApi.login(testData.adminEmail, 'A_M4tch1ng_P4ssw0rd', true);
// Check
expect(response.status).to.be.eql(HTTPError.OBJECT_DOES_NOT_EXIST_ERROR);
expect(response.data).to.not.have.property('token');
});
+ it('Should not allow authentication with a password that doesn\'t match requirements', async () => {
+ // Call
+ const response = await CentralServerService.defaultInstance.authenticationApi.login(testData.adminEmail, '1234', true);
+ // Check
+ expect(response.status).to.be.eql(StatusCodes.INTERNAL_SERVER_ERROR);
+ expect(response.data).to.not.have.property('token');
+ });
+
it('Should not allow authentication without password', async () => {
// Call
const response = await CentralServerService.defaultInstance.authenticationApi.login(

Fixed user creation with empty password