diff --git a/src/frontend/app/administration/otp/otp.component.html b/src/frontend/app/administration/otp/otp.component.html index 7df870997700f4a896dc3af8d4f513f00d2cfd2a..a6fcd858c12491d3003b1da842095c0199e90fe4 100644 --- a/src/frontend/app/administration/otp/otp.component.html +++ b/src/frontend/app/administration/otp/otp.component.html @@ -121,7 +121,7 @@ <ion-item text-center lines="none" style="position: sticky;bottom:0px;z-index:1;"> <div style="display: flex;align-items: center;justify-content: center;width: 100%;background: white;"> <ion-button type="submit" shape="round" size="large" fill="outline" color="primary" - [disabled]="!adminForm.form.valid"> + [disabled]="!adminForm.form.valid || !functions.isValidUrl(connector.apiUri)"> <ion-label style="font-size: 13px;">{{'lang.validate' | translate}}</ion-label> </ion-button> <ion-button *ngIf="!creationMode" type="button" shape="round" size="large" fill="outline" color="danger" diff --git a/src/frontend/app/service/functions.service.ts b/src/frontend/app/service/functions.service.ts index 15b1a94ba4fe9e283c5c860404bd1a25fb4de7a1..dc3565e4a19a4e0f5fb072740fcb2fe5ba553a9d 100644 --- a/src/frontend/app/service/functions.service.ts +++ b/src/frontend/app/service/functions.service.ts @@ -200,4 +200,9 @@ export class FunctionsService { ).subscribe(); }); } + + isValidUrl(value: string): boolean { + const pattern = /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/; + return pattern.test(value); + } }