Pull request: 3684 validate client id in the mobileconfig form

Closes #3684

Squashed commit of the following:

commit 78e9862f7a06262f91c28d6ddcc10512560eedae
Author: Ildar Kamalov <ik@adguard.com>
Date:   Fri Oct 15 14:39:36 2021 +0300

    fix build

commit 3ed4ee69590f238396dd3aab2b62f110baa6d681
Author: Ildar Kamalov <ik@adguard.com>
Date:   Fri Oct 15 13:39:12 2021 +0300

    client: validate client id in the mobileconfig form
This commit is contained in:
Ildar Kamalov
2021-10-15 15:01:50 +03:00
parent 2796e65468
commit 3fa38fb420
3 changed files with 18 additions and 3 deletions

View File

@@ -83,6 +83,21 @@ export const validateClientId = (value) => {
return undefined;
};
/**
* @param value {string}
* @returns {undefined|string}
*/
export const validateConfigClientId = (value) => {
if (!value) {
return undefined;
}
const formattedValue = value.trim();
if (formattedValue && !R_CLIENT_ID.test(formattedValue)) {
return 'form_error_client_id_format';
}
return undefined;
};
/**
* @param value {string}
* @returns {undefined|string}