From e8143c5c54b4d0b4a1aab6ffacb166a6da06c042 Mon Sep 17 00:00:00 2001
From: Benoit Lavenier <benoit.lavenier@e-is.pro>
Date: Fri, 4 Sep 2020 16:24:34 +0200
Subject: [PATCH] [fix] Allow to reload same avatar image, or same file upload

---
 www/js/directives.js                                | 4 ++++
 www/plugins/es/js/controllers/common-controllers.js | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/www/js/directives.js b/www/js/directives.js
index 9b2350b4..e207a926 100644
--- a/www/js/directives.js
+++ b/www/js/directives.js
@@ -464,6 +464,10 @@ angular.module('cesium.directives', [])
                   fileContent: onLoadEvent.target.result,
                   fileData : fileData}
               });
+
+              // Reset the input file
+              fileInput[0].value = '';
+
             });
           };
           reader.readAsText((onChangeEvent.srcElement || onChangeEvent.target).files[0]);
diff --git a/www/plugins/es/js/controllers/common-controllers.js b/www/plugins/es/js/controllers/common-controllers.js
index 3f2e0e49..b2aa4ef1 100644
--- a/www/plugins/es/js/controllers/common-controllers.js
+++ b/www/plugins/es/js/controllers/common-controllers.js
@@ -461,6 +461,10 @@ function ESAvatarModalController($scope, $sce) {
 
   $scope.doPrevious = function() {
     $scope.formData.imageCropStep -= 1;
+    // Reset the image
+    if ($scope.formData.imageCropStep === 1) {
+      $scope.formData.imgSrc = undefined;
+    }
   };
 
   $scope.doCrop = function() {
-- 
GitLab