mirror of
https://github.com/logto-io/logto.git
synced 2025-03-31 22:51:25 -05:00
fix(phrases,shared): only allow lowercase letters, numbers and hyphens in subdomains (#5332)
This commit is contained in:
parent
4414139b32
commit
50f8756721
17 changed files with 18 additions and 16 deletions
|
@ -46,7 +46,7 @@ const protected_app = {
|
|||
domain_in_use: 'This subdomain name is already in use.',
|
||||
/** UNTRANSLATED */
|
||||
invalid_domain_format:
|
||||
"Invalid subdomain format: use only lowercase letters, hyphens '-', and underscores '_'.",
|
||||
"Invalid subdomain format: use only lowercase letters, numbers, and hyphens '-'.",
|
||||
/** UNTRANSLATED */
|
||||
url_required: 'Origin URL is required.',
|
||||
/** UNTRANSLATED */
|
||||
|
|
|
@ -26,7 +26,7 @@ const protected_app = {
|
|||
domain_required: 'Subdomain is required',
|
||||
domain_in_use: 'This subdomain name is already in use.',
|
||||
invalid_domain_format:
|
||||
"Invalid subdomain format: use only lowercase letters, hyphens '-', and underscores '_'.",
|
||||
"Invalid subdomain format: use only lowercase letters, numbers, and hyphens '-'.",
|
||||
url_required: 'Origin URL is required.',
|
||||
invalid_url:
|
||||
"Invalid Origin URL format: Use http:// or https://. Note: '/routes' is not currently supported.",
|
||||
|
|
|
@ -46,7 +46,7 @@ const protected_app = {
|
|||
domain_in_use: 'This subdomain name is already in use.',
|
||||
/** UNTRANSLATED */
|
||||
invalid_domain_format:
|
||||
"Invalid subdomain format: use only lowercase letters, hyphens '-', and underscores '_'.",
|
||||
"Invalid subdomain format: use only lowercase letters, numbers, and hyphens '-'.",
|
||||
/** UNTRANSLATED */
|
||||
url_required: 'Origin URL is required.',
|
||||
/** UNTRANSLATED */
|
||||
|
|
|
@ -46,7 +46,7 @@ const protected_app = {
|
|||
domain_in_use: 'This subdomain name is already in use.',
|
||||
/** UNTRANSLATED */
|
||||
invalid_domain_format:
|
||||
"Invalid subdomain format: use only lowercase letters, hyphens '-', and underscores '_'.",
|
||||
"Invalid subdomain format: use only lowercase letters, numbers, and hyphens '-'.",
|
||||
/** UNTRANSLATED */
|
||||
url_required: 'Origin URL is required.',
|
||||
/** UNTRANSLATED */
|
||||
|
|
|
@ -46,7 +46,7 @@ const protected_app = {
|
|||
domain_in_use: 'This subdomain name is already in use.',
|
||||
/** UNTRANSLATED */
|
||||
invalid_domain_format:
|
||||
"Invalid subdomain format: use only lowercase letters, hyphens '-', and underscores '_'.",
|
||||
"Invalid subdomain format: use only lowercase letters, numbers, and hyphens '-'.",
|
||||
/** UNTRANSLATED */
|
||||
url_required: 'Origin URL is required.',
|
||||
/** UNTRANSLATED */
|
||||
|
|
|
@ -46,7 +46,7 @@ const protected_app = {
|
|||
domain_in_use: 'This subdomain name is already in use.',
|
||||
/** UNTRANSLATED */
|
||||
invalid_domain_format:
|
||||
"Invalid subdomain format: use only lowercase letters, hyphens '-', and underscores '_'.",
|
||||
"Invalid subdomain format: use only lowercase letters, numbers, and hyphens '-'.",
|
||||
/** UNTRANSLATED */
|
||||
url_required: 'Origin URL is required.',
|
||||
/** UNTRANSLATED */
|
||||
|
|
|
@ -46,7 +46,7 @@ const protected_app = {
|
|||
domain_in_use: 'This subdomain name is already in use.',
|
||||
/** UNTRANSLATED */
|
||||
invalid_domain_format:
|
||||
"Invalid subdomain format: use only lowercase letters, hyphens '-', and underscores '_'.",
|
||||
"Invalid subdomain format: use only lowercase letters, numbers, and hyphens '-'.",
|
||||
/** UNTRANSLATED */
|
||||
url_required: 'Origin URL is required.',
|
||||
/** UNTRANSLATED */
|
||||
|
|
|
@ -46,7 +46,7 @@ const protected_app = {
|
|||
domain_in_use: 'This subdomain name is already in use.',
|
||||
/** UNTRANSLATED */
|
||||
invalid_domain_format:
|
||||
"Invalid subdomain format: use only lowercase letters, hyphens '-', and underscores '_'.",
|
||||
"Invalid subdomain format: use only lowercase letters, numbers, and hyphens '-'.",
|
||||
/** UNTRANSLATED */
|
||||
url_required: 'Origin URL is required.',
|
||||
/** UNTRANSLATED */
|
||||
|
|
|
@ -46,7 +46,7 @@ const protected_app = {
|
|||
domain_in_use: 'This subdomain name is already in use.',
|
||||
/** UNTRANSLATED */
|
||||
invalid_domain_format:
|
||||
"Invalid subdomain format: use only lowercase letters, hyphens '-', and underscores '_'.",
|
||||
"Invalid subdomain format: use only lowercase letters, numbers, and hyphens '-'.",
|
||||
/** UNTRANSLATED */
|
||||
url_required: 'Origin URL is required.',
|
||||
/** UNTRANSLATED */
|
||||
|
|
|
@ -46,7 +46,7 @@ const protected_app = {
|
|||
domain_in_use: 'This subdomain name is already in use.',
|
||||
/** UNTRANSLATED */
|
||||
invalid_domain_format:
|
||||
"Invalid subdomain format: use only lowercase letters, hyphens '-', and underscores '_'.",
|
||||
"Invalid subdomain format: use only lowercase letters, numbers, and hyphens '-'.",
|
||||
/** UNTRANSLATED */
|
||||
url_required: 'Origin URL is required.',
|
||||
/** UNTRANSLATED */
|
||||
|
|
|
@ -46,7 +46,7 @@ const protected_app = {
|
|||
domain_in_use: 'This subdomain name is already in use.',
|
||||
/** UNTRANSLATED */
|
||||
invalid_domain_format:
|
||||
"Invalid subdomain format: use only lowercase letters, hyphens '-', and underscores '_'.",
|
||||
"Invalid subdomain format: use only lowercase letters, numbers, and hyphens '-'.",
|
||||
/** UNTRANSLATED */
|
||||
url_required: 'Origin URL is required.',
|
||||
/** UNTRANSLATED */
|
||||
|
|
|
@ -46,7 +46,7 @@ const protected_app = {
|
|||
domain_in_use: 'This subdomain name is already in use.',
|
||||
/** UNTRANSLATED */
|
||||
invalid_domain_format:
|
||||
"Invalid subdomain format: use only lowercase letters, hyphens '-', and underscores '_'.",
|
||||
"Invalid subdomain format: use only lowercase letters, numbers, and hyphens '-'.",
|
||||
/** UNTRANSLATED */
|
||||
url_required: 'Origin URL is required.',
|
||||
/** UNTRANSLATED */
|
||||
|
|
|
@ -46,7 +46,7 @@ const protected_app = {
|
|||
domain_in_use: 'This subdomain name is already in use.',
|
||||
/** UNTRANSLATED */
|
||||
invalid_domain_format:
|
||||
"Invalid subdomain format: use only lowercase letters, hyphens '-', and underscores '_'.",
|
||||
"Invalid subdomain format: use only lowercase letters, numbers, and hyphens '-'.",
|
||||
/** UNTRANSLATED */
|
||||
url_required: 'Origin URL is required.',
|
||||
/** UNTRANSLATED */
|
||||
|
|
|
@ -46,7 +46,7 @@ const protected_app = {
|
|||
domain_in_use: 'This subdomain name is already in use.',
|
||||
/** UNTRANSLATED */
|
||||
invalid_domain_format:
|
||||
"Invalid subdomain format: use only lowercase letters, hyphens '-', and underscores '_'.",
|
||||
"Invalid subdomain format: use only lowercase letters, numbers, and hyphens '-'.",
|
||||
/** UNTRANSLATED */
|
||||
url_required: 'Origin URL is required.',
|
||||
/** UNTRANSLATED */
|
||||
|
|
|
@ -46,7 +46,7 @@ const protected_app = {
|
|||
domain_in_use: 'This subdomain name is already in use.',
|
||||
/** UNTRANSLATED */
|
||||
invalid_domain_format:
|
||||
"Invalid subdomain format: use only lowercase letters, hyphens '-', and underscores '_'.",
|
||||
"Invalid subdomain format: use only lowercase letters, numbers, and hyphens '-'.",
|
||||
/** UNTRANSLATED */
|
||||
url_required: 'Origin URL is required.',
|
||||
/** UNTRANSLATED */
|
||||
|
|
|
@ -14,5 +14,7 @@ describe('isValidSubdomain()', () => {
|
|||
expect(isValidSubdomain('-a1')).toBe(false);
|
||||
expect(isValidSubdomain('a1-')).toBe(false);
|
||||
expect(isValidSubdomain('a1.b')).toBe(false);
|
||||
expect(isValidSubdomain('a_b')).toBe(false);
|
||||
expect(isValidSubdomain('aBc')).toBe(false);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
* @returns boolean indicating whether the subdomain is valid
|
||||
*/
|
||||
export const isValidSubdomain = (subdomain: string): boolean =>
|
||||
/^([\da-z]([\da-z-]{0,61}[\da-z])?)$/i.test(subdomain);
|
||||
/^([\da-z]([\da-z-]{0,61}[\da-z])?)$/.test(subdomain);
|
||||
|
|
Loading…
Add table
Reference in a new issue