0
Fork 0
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:
Charles Zhao 2024-01-30 12:33:08 +08:00 committed by GitHub
parent 4414139b32
commit 50f8756721
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 18 additions and 16 deletions

View file

@ -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 */

View file

@ -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.",

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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);
});
});

View file

@ -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);