@dhis2/ui-forms 8.4.1 → 8.4.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,12 +19,12 @@
19
19
  "Password should contain at least one UPPERCASE letter": "Password should contain at least one UPPERCASE letter",
20
20
  "Password should contain at least one number": "Password should contain at least one number",
21
21
  "Password should have at least one special character": "Password should have at least one special character",
22
- "Please provide a username between 4 and 255 characters": "Please provide a username between 4 and 255 characters",
23
22
  "Please provide a valid email address": "Please provide a valid email address",
24
23
  "Please provide a value": "Please provide a value",
25
24
  "Please provide a round number without decimals": "Please provide a round number without decimals",
26
25
  "Please provide a valid international phone number.": "Please provide a valid international phone number.",
27
26
  "Please provide a number": "Please provide a number",
28
27
  "Please provide a string": "Please provide a string",
29
- "Please provide a valid url": "Please provide a valid url"
28
+ "Please provide a valid url": "Please provide a valid url",
29
+ "Please provide a username between 4 and 255 characters long and possibly separated by . _ @ or #": "Please provide a username between 4 and 255 characters long and possibly separated by . _ @ or #"
30
30
  }
@@ -20,7 +20,7 @@ describe('validator: dhis2Username', () => {
20
20
  (0, _index.testValidatorValues)(_dhis2Username.dhis2Username, _dhis2Username.invalidUsernameMessage, ['__xx', '..xx', '@@xx']);
21
21
  });
22
22
  describe('constrains characters in usernames to [a-z0-9._@]', () => {
23
- (0, _index.testValidatorValues)(_dhis2Username.dhis2Username, undefined, ['v@lid_user.name', '123another_v@lid_usern@me']);
23
+ (0, _index.testValidatorValues)(_dhis2Username.dhis2Username, undefined, ['v@lid_user.name', '123another_v@lid_usern@me', 'UPPER_CASE', 'lower@ca.se']);
24
24
  (0, _index.testValidatorValues)(_dhis2Username.dhis2Username, _dhis2Username.invalidUsernameMessage, ['あいうえお', 'some_username^%&*(']);
25
25
  });
26
26
  describe('rejects non-string data types', () => {
@@ -11,9 +11,9 @@ var _index2 = require("./helpers/index.js");
11
11
 
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
 
14
- const USERNAME_PATTERN = /^(?=.{4,255}$)(?![_.@])(?!.*[_.@]{2})[a-z0-9._@]+(?<![_.@])$/;
14
+ const USERNAME_PATTERN = /^(?=.{4,255}$)(?![_.@])(?!.*[_.@]{2})[a-zA-Z0-9._@]+(?<![_.@])$/;
15
15
 
16
- const invalidUsernameMessage = _index.default.t('Please provide a username between 4 and 255 characters');
16
+ const invalidUsernameMessage = _index.default.t('Please provide a username between 4 and 255 characters long and possibly separated by . _ @ or #');
17
17
 
18
18
  exports.invalidUsernameMessage = invalidUsernameMessage;
19
19
 
@@ -19,12 +19,12 @@
19
19
  "Password should contain at least one UPPERCASE letter": "Password should contain at least one UPPERCASE letter",
20
20
  "Password should contain at least one number": "Password should contain at least one number",
21
21
  "Password should have at least one special character": "Password should have at least one special character",
22
- "Please provide a username between 4 and 255 characters": "Please provide a username between 4 and 255 characters",
23
22
  "Please provide a valid email address": "Please provide a valid email address",
24
23
  "Please provide a value": "Please provide a value",
25
24
  "Please provide a round number without decimals": "Please provide a round number without decimals",
26
25
  "Please provide a valid international phone number.": "Please provide a valid international phone number.",
27
26
  "Please provide a number": "Please provide a number",
28
27
  "Please provide a string": "Please provide a string",
29
- "Please provide a valid url": "Please provide a valid url"
28
+ "Please provide a valid url": "Please provide a valid url",
29
+ "Please provide a username between 4 and 255 characters long and possibly separated by . _ @ or #": "Please provide a username between 4 and 255 characters long and possibly separated by . _ @ or #"
30
30
  }
@@ -16,7 +16,7 @@ describe('validator: dhis2Username', () => {
16
16
  testValidatorValues(dhis2Username, invalidUsernameMessage, ['__xx', '..xx', '@@xx']);
17
17
  });
18
18
  describe('constrains characters in usernames to [a-z0-9._@]', () => {
19
- testValidatorValues(dhis2Username, undefined, ['v@lid_user.name', '123another_v@lid_usern@me']);
19
+ testValidatorValues(dhis2Username, undefined, ['v@lid_user.name', '123another_v@lid_usern@me', 'UPPER_CASE', 'lower@ca.se']);
20
20
  testValidatorValues(dhis2Username, invalidUsernameMessage, ['あいうえお', 'some_username^%&*(']);
21
21
  });
22
22
  describe('rejects non-string data types', () => {
@@ -1,7 +1,7 @@
1
1
  import i18n from '../locales/index.js';
2
2
  import { isEmpty, isString } from './helpers/index.js';
3
- const USERNAME_PATTERN = /^(?=.{4,255}$)(?![_.@])(?!.*[_.@]{2})[a-z0-9._@]+(?<![_.@])$/;
4
- const invalidUsernameMessage = i18n.t('Please provide a username between 4 and 255 characters');
3
+ const USERNAME_PATTERN = /^(?=.{4,255}$)(?![_.@])(?!.*[_.@]{2})[a-zA-Z0-9._@]+(?<![_.@])$/;
4
+ const invalidUsernameMessage = i18n.t('Please provide a username between 4 and 255 characters long and possibly separated by . _ @ or #');
5
5
 
6
6
  const dhis2Username = value => isEmpty(value) || isString(value) && USERNAME_PATTERN.test(value) ? undefined : invalidUsernameMessage;
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2/ui-forms",
3
- "version": "8.4.1",
3
+ "version": "8.4.4",
4
4
  "main": "./build/cjs/index.js",
5
5
  "module": "./build/es/index.js",
6
6
  "sideEffects": [
@@ -34,15 +34,15 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@dhis2/prop-types": "^3.1.2",
37
- "@dhis2-ui/button": "8.4.1",
38
- "@dhis2-ui/checkbox": "8.4.1",
39
- "@dhis2-ui/field": "8.4.1",
40
- "@dhis2-ui/file-input": "8.4.1",
41
- "@dhis2-ui/input": "8.4.1",
42
- "@dhis2-ui/radio": "8.4.1",
43
- "@dhis2-ui/select": "8.4.1",
44
- "@dhis2-ui/switch": "8.4.1",
45
- "@dhis2-ui/text-area": "8.4.1",
37
+ "@dhis2-ui/button": "8.4.4",
38
+ "@dhis2-ui/checkbox": "8.4.4",
39
+ "@dhis2-ui/field": "8.4.4",
40
+ "@dhis2-ui/file-input": "8.4.4",
41
+ "@dhis2-ui/input": "8.4.4",
42
+ "@dhis2-ui/radio": "8.4.4",
43
+ "@dhis2-ui/select": "8.4.4",
44
+ "@dhis2-ui/switch": "8.4.4",
45
+ "@dhis2-ui/text-area": "8.4.4",
46
46
  "classnames": "^2.3.1",
47
47
  "final-form": "^4.20.2",
48
48
  "prop-types": "^15.7.2",