Commit a38d3810 authored by Hamza HRAMCHI's avatar Hamza HRAMCHI
Browse files

FIX #18428 TIME 0:20 Admin/Maarch2Maarch: check if password is already defined

parent eab1f62e
......@@ -275,7 +275,8 @@ class ConfigurationController
'communications' => [
'email' => $xmlConfig['m2m_communication_type']['email'],
'uri' => $xmlConfig['m2m_communication_type']['url'],
'login' => $xmlConfig['m2m_login'][0] ?? null
'login' => $xmlConfig['m2m_login'][0] ?? null,
'passwordAlreadyExists' => !empty($xmlConfig['m2m_password']) ? true : false
]
];
......
<ng-container *ngIf="!loading; else elseTemplate">
<app-maarch-message [content]="'lang.maarch2maarchDesc' | translate : {url : maarch2maarchUrl}">
</app-maarch-message>
<app-maarch-message *ngIf="!passwordAlreadyExists" [mode]="'danger'" [content]="'lang.m2mPasswordMsg' | translate"></app-maarch-message>
<div class="formType" style="margin-top: 20px;">
<div class="formType-title">
{{('lang.communicationMeans' | translate)}}
......
......@@ -40,7 +40,7 @@ export class MaarchToMaarchParametersComponent implements OnInit {
communications = {
uri: new FormControl('https://demo.maarchcourrier.com'),
login: new FormControl('cchaplin'),
password: new FormControl('maarch'),
password: new FormControl(null),
email: new FormControl(null),
};
annuary = {
......@@ -58,6 +58,8 @@ export class MaarchToMaarchParametersComponent implements OnInit {
};
maarch2maarchUrl: string = `https://docs.maarch.org/gitbook/html/MaarchCourrier/${environment.VERSION.split('.')[0] + '.' + environment.VERSION.split('.')[1]}/guat/guat_exploitation/maarch2maarch.html`;
passwordAlreadyExists: boolean = false;
constructor(
public translate: TranslateService,
public http: HttpClient,
......@@ -195,8 +197,9 @@ export class MaarchToMaarchParametersComponent implements OnInit {
this.http.get('../rest/m2m/configuration').pipe(
map((data: any) => data.configuration),
tap((data: any) => {
Object.keys(this.communications).forEach(elemId => {
if (!this.functionsService.empty(data.communications[elemId])) {
this.passwordAlreadyExists = data.communications.passwordAlreadyExists ? true : false;
Object.keys(this.communications).forEach((elemId: any) => {
if (['uri', 'login', 'email'].indexOf(elemId) > -1) {
this.communications[elemId].setValue(data.communications[elemId]);
}
this.communications[elemId].valueChanges
......@@ -362,6 +365,7 @@ export class MaarchToMaarchParametersComponent implements OnInit {
this.http.put('../rest/m2m/configuration', { configuration: this.formatConfiguration() }).pipe(
tap(() => {
this.notify.success(this.translate.instant('lang.dataUpdated'));
this.passwordAlreadyExists = this.functionsService.empty(this.communications['password'].value) ? false : true;
}),
catchError((err: any) => {
this.notify.handleErrors(err);
......
......@@ -2559,5 +2559,7 @@
"userIdMaarch2Maarch": "User identifier",
"userPasswordMaarch2Maarch": "User password",
"userIdMaarch2MaarchDesc": "User ID with a web service account",
"userPasswordMaarch2MaarchDesc": "User password with a web service account"
"userPasswordMaarch2MaarchDesc": "User password with a web service account",
"m2mPasswordMsg": "The password for your <b>web service user</b> is not defined"
}
......@@ -2549,5 +2549,6 @@
"userIdMaarch2Maarch": "Identifiant de l'utilisateur",
"userPasswordMaarch2Maarch": "Mot de passe de l'utilisateur",
"userIdMaarch2MaarchDesc": "Identifiant de l'utilisateur avec un compte webservice",
"userPasswordMaarch2MaarchDesc": "Mot de passe de l'utilisateur avec un compte webservice"
"userPasswordMaarch2MaarchDesc": "Mot de passe de l'utilisateur avec un compte webservice",
"m2mPasswordMsg": "Le mot de passe de votre <b>utilisateur webservice</b> n'est pas défini"
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment