diff --git a/src/core/controllers/AuthenticationController.php b/src/core/controllers/AuthenticationController.php index 5549c0f411b6ed1c61f76924772bb715d3e81039..11957b260edd657ffc83279317068178ec008f27 100755 --- a/src/core/controllers/AuthenticationController.php +++ b/src/core/controllers/AuthenticationController.php @@ -50,15 +50,15 @@ class AuthenticationController public function getValidUrl(Request $request, Response $response) { if (!is_file('custom/custom.json')) { - return $response->withJson(['message' => 'No custom file', 'lang' => '']); + return $response->withJson(['message' => 'No custom file', 'lang' => 'noConfiguration']); } $jsonFile = file_get_contents('custom/custom.json'); $jsonFile = json_decode($jsonFile, true); if (count($jsonFile) == 0) { - return $response->withJson(['message' => 'No custom', 'lang' => '']); + return $response->withJson(['message' => 'No custom', 'lang' => 'noConfiguration']); } elseif (count($jsonFile) > 1) { - return $response->withJson(['message' => 'There is more than 1 custom', 'lang' => '']); + return $response->withJson(['message' => 'There is more than 1 custom', 'lang' => 'moreOneCustom']); } $url = null; diff --git a/src/frontend/app/login/login.component.ts b/src/frontend/app/login/login.component.ts index 49bc0aa7dd5250a24e6dafb7b169ac354c79e0a8..e423216b86d38639271a7cab82153f174568c724 100644 --- a/src/frontend/app/login/login.component.ts +++ b/src/frontend/app/login/login.component.ts @@ -12,6 +12,7 @@ import { of } from 'rxjs/internal/observable/of'; import { HeaderService } from '../../service/header.service'; import { FunctionsService } from '../../service/functions.service'; import { TimeLimitPipe } from '../../plugins/timeLimit.pipe'; +import { AlertComponent } from '../../plugins/modal/alert.component'; @Component({ templateUrl: 'login.component.html', @@ -114,33 +115,17 @@ export class LoginComponent implements OnInit { catchError((err: any) => { this.http.get('../rest/validUrl').pipe( tap((data: any) => { - if (data.url !== null) { + if (!this.functionsService.empty(data.url)) { window.location.href = data.url; + } else if (data.lang === 'moreOneCustom') { + this.dialog.open(AlertComponent, { panelClass: 'maarch-modal', autoFocus: false, disableClose: true, data: { title: this.lang.accessNotFound, msg: this.lang.moreOneCustom, hideButton: true } }); + } else if (data.lang === 'noConfiguration') { + // TO DO : LAUNCH INSTALLER } else { this.notify.handleSoftErrors(err); } }) ).subscribe(); - // TO DO : CONVERT custom.xml to json - /*if (err.error.exception[0].message === 'Argument driver is empty') { - const configs = [{ - custom_id : 'cs_recette', - ip : '', - external_domain : '', - path: 'cs_recette' - }]; - const firstConfig = configs.map(item => item.custom_id).filter((customId) => !this.functionsService.empty(customId)); - - if (firstConfig.length > 0) { - const url = document.URL; - const splitUrl = url.split('/dist/'); - window.location.href = `${splitUrl[0]}/${firstConfig[0]}/dist/${splitUrl[1]}`; - } else { - this.notify.error('Aucun custom ou fichier de configuration trouvé!'); - } - } else { - this.notify.handleSoftErrors(err); - }*/ return of(false); }) ).subscribe(); diff --git a/src/frontend/css/maarch-material-modal.scss b/src/frontend/css/maarch-material-modal.scss index e602f38c319d22817cb11ece4e4f12d1ff68d06f..0daf9d1e2541dc858b69c8e1df7bceb6fdd6f738 100644 --- a/src/frontend/css/maarch-material-modal.scss +++ b/src/frontend/css/maarch-material-modal.scss @@ -57,6 +57,7 @@ margin: 0px; position: relative; padding-top: 10px; + padding-bottom: 10px; } .mat-dialog-container { @@ -110,6 +111,7 @@ margin: 0px; position: relative; padding-top: 10px; + padding-bottom: 10px; } .mat-dialog-container { diff --git a/src/frontend/lang/lang-en.ts b/src/frontend/lang/lang-en.ts index 18e877ca1358073c34c2a6f81e7a9ec28cd99d4c..dd6c758a977a12d16d793481cd22f46e213c7a4b 100755 --- a/src/frontend/lang/lang-en.ts +++ b/src/frontend/lang/lang-en.ts @@ -1675,4 +1675,6 @@ export const LANG_EN = { "modelUsedByResources": "This model is used by resources, you can't delete it.", "mustChangePassword": "Please, you must change your password.", "linkedResources": "Attachments (linked mails)", + "accessNotFound": "Access not found", + "moreOneCustom": "This url is not an available instance of this application, please verify your address.", }; diff --git a/src/frontend/lang/lang-fr.ts b/src/frontend/lang/lang-fr.ts index 44511215d4deed6b79423bc5ba7ca23b1407ea83..51a7565f7546d8b429d40469d5a9cc50a62413dc 100755 --- a/src/frontend/lang/lang-fr.ts +++ b/src/frontend/lang/lang-fr.ts @@ -1675,4 +1675,6 @@ export const LANG_FR = { "modelUsedByResources": "Le modèle est utilisé par des courriers, vous ne pouvez pas le supprimer.", "mustChangePassword": "Vous êtes invité à changer votre mot de passe.", "linkedResources": "Pièces jointes (courriers liés)", + "accessNotFound": "Accès introuvable", + "moreOneCustom": "Cette url ne correspond à aucune instance configurée, veuillez vérifier l'adresse.", }; diff --git a/src/frontend/lang/lang-nl.ts b/src/frontend/lang/lang-nl.ts index 9e9e07084533331af152470ce41e5676aff193cf..506aa45d111b11b40765429fbbeaeb4300359dd5 100755 --- a/src/frontend/lang/lang-nl.ts +++ b/src/frontend/lang/lang-nl.ts @@ -1659,4 +1659,6 @@ export const LANG_NL = { "modelUsedByResources": "This model is used by resources, you can't delete it.", //_TO_TRANSLATE "mustChangePassword": "Please, you must change your password.", //_TO_TRANSLATE "linkedResources": "Attachments (linked mails)", //_TO_TRANSLATE + "accessNotFound": "Access not found", //_TO_TRANSLATE + "moreOneCustom": "This url is not an available instance of this application, please verify your address.", //_TO_TRANSLATE }; diff --git a/src/frontend/plugins/modal/alert.component.html b/src/frontend/plugins/modal/alert.component.html index 5e260f3352cb73cb98cced2b847d86c2467b8b9b..ce322d1a4848324376e6e02362041d07da13f722 100644 --- a/src/frontend/plugins/modal/alert.component.html +++ b/src/frontend/plugins/modal/alert.component.html @@ -4,7 +4,7 @@ <div class="alert-message alert-message-info" [innerHTML]="data.msg"></div> </div> <span class="divider-modal"></span> - <div mat-dialog-actions> + <div mat-dialog-actions *ngIf="data.hidebutton"> <button class="actions" color="primary" mat-raised-button (click)="this.dialogRef.close();">{{lang.ok}}</button> </div> </div> \ No newline at end of file