UI: Fixed validation issues for URLs on the mobile page configuration, including Unicode symbols
This commit is contained in:
		
							parent
							
								
									862f8e0d74
								
							
						
					
					
						commit
						f2b5aa9549
					
				@ -24,7 +24,12 @@ import {
 | 
			
		||||
  Validator,
 | 
			
		||||
  Validators
 | 
			
		||||
} from '@angular/forms';
 | 
			
		||||
import { CustomMobilePage, MobilePageType, mobilePageTypeTranslations } from '@shared/models/mobile-app.models';
 | 
			
		||||
import {
 | 
			
		||||
  CustomMobilePage,
 | 
			
		||||
  MobilePageType,
 | 
			
		||||
  mobilePageTypeTranslations,
 | 
			
		||||
  WEB_URL_REGEX
 | 
			
		||||
} from '@shared/models/mobile-app.models';
 | 
			
		||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
 | 
			
		||||
import { getCurrentAuthUser } from '@core/auth/auth.selectors';
 | 
			
		||||
import { Authority } from '@shared/models/authority.enum';
 | 
			
		||||
@ -63,8 +68,8 @@ export class CustomMobilePageComponent implements ControlValueAccessor, Validato
 | 
			
		||||
    label: ['', [Validators.required, Validators.pattern(/\S/)]],
 | 
			
		||||
    type: [MobilePageType.DASHBOARD],
 | 
			
		||||
    dashboardId: this.fb.control<string>(null, Validators.required),
 | 
			
		||||
    url: [{value:'', disabled: true}, [Validators.required, Validators.pattern(/^(https?:\/\/)?(localhost|([\w\-]+\.)+[\w\-]+)(:\d+)?(\/[\w\-._~:\/?#[\]@!$&'()*+,;=%]*)?$/)]],
 | 
			
		||||
    path: [{value:'', disabled: true}, [Validators.required, Validators.pattern(/^(\/[\w\-._~:\/?#[\]@!$&'()*+,;=%]*)?$/)]]
 | 
			
		||||
    url: [{value:'', disabled: true}, [Validators.required, Validators.pattern(WEB_URL_REGEX)]],
 | 
			
		||||
    path: [{value:'', disabled: true}, [Validators.required, Validators.pattern(/^(\/[\w\-._~:/?#[\]@!$&'()*+,;=%]*)?$/)]]
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  private propagateChange = (_val: any) => {};
 | 
			
		||||
 | 
			
		||||
@ -21,6 +21,8 @@ import { OAuth2ClientInfo, PlatformType } from '@shared/models/oauth2.models';
 | 
			
		||||
import { MobileAppBundleId } from '@shared/models/id/mobile-app-bundle-id';
 | 
			
		||||
import { deepClone, isNotEmptyStr } from '@core/utils';
 | 
			
		||||
 | 
			
		||||
export const WEB_URL_REGEX = /^(https?:\/\/)?(localhost|([\p{L}\p{M}\w-]+\.)+[\p{L}\p{M}\w-]+)(:\d+)?(\/[\w\-._~:/?#[\]@!$&'()*+,;=%\p{L}\p{N}]*)?$/u;
 | 
			
		||||
 | 
			
		||||
export interface QrCodeSettings extends HasTenantId {
 | 
			
		||||
  useDefaultApp: boolean;
 | 
			
		||||
  mobileAppBundleId: MobileAppBundleId
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user