From 24de59338b0dad9dc8349124b8b244fbd2aa3f4f Mon Sep 17 00:00:00 2001
From: Alex ORLUC <alex.orluc@maarch.org>
Date: Wed, 13 May 2020 12:23:53 +0200
Subject: [PATCH] FEAT #13664 TIME 0:15 add test without re-type password

---
 .../alfresco-administration.component.html     |  2 +-
 .../alfresco-administration.component.ts       | 18 +++++++++++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/frontend/app/administration/alfresco/alfresco-administration.component.html b/src/frontend/app/administration/alfresco/alfresco-administration.component.html
index f8cfc5ca02e..2eed6260442 100644
--- a/src/frontend/app/administration/alfresco/alfresco-administration.component.html
+++ b/src/frontend/app/administration/alfresco/alfresco-administration.component.html
@@ -78,7 +78,7 @@
                         </div>
                         <div class="col-sm-12 text-center" style="padding:10px;">
                             <button mat-raised-button type="button" color="primary" (click)="checkAccount()"
-                                [disabled]="functionsService.empty(alfresco.account.id) || functionsService.empty(alfresco.account.password)">{{lang.test}}</button>
+                                [disabled]="functionsService.empty(alfresco.account.id) || (functionsService.empty(alfresco.account.password) && creationMode)">{{lang.test}}</button>
 
                             <button mat-raised-button type="submit" color="primary"
                                 [disabled]="!alfrescoForm.valid || !validAccount()">{{lang.validate}}</button>
diff --git a/src/frontend/app/administration/alfresco/alfresco-administration.component.ts b/src/frontend/app/administration/alfresco/alfresco-administration.component.ts
index c72b9b5e707..0dd2fb46966 100644
--- a/src/frontend/app/administration/alfresco/alfresco-administration.component.ts
+++ b/src/frontend/app/administration/alfresco/alfresco-administration.component.ts
@@ -280,7 +280,23 @@ export class AlfrescoAdministrationComponent implements OnInit {
     }
 
     checkAccount() {
-        this.http.post(`../rest/alfresco/checkAccounts`, { login: this.alfresco.account.id, password: this.alfresco.account.password, nodeId : this.alfresco.rootFolder }).pipe(
+        let alfresco  = {};
+        if (!this.creationMode) {
+            alfresco = {
+                accountId : this.alfresco.id,
+                login: this.alfresco.account.id,
+                password: this.alfresco.account.password,
+                nodeId : this.alfresco.rootFolder
+            };
+        } else {
+            alfresco = {
+                login: this.alfresco.account.id,
+                password: this.alfresco.account.password,
+                nodeId : this.alfresco.rootFolder
+            };
+        }
+
+        this.http.post(`../rest/alfresco/checkAccounts`, alfresco).pipe(
             tap(() => {
                 this.notify.success(this.lang.testSucceeded);
             }),
-- 
GitLab