changeset 5525:fcab36751490

Client: Force entering a password by user-reactivation * Make entering both email and password for reactivating a user required.
author Fadi Abbud <fadi.abbud@intevation.de>
date Mon, 25 Oct 2021 16:19:13 +0200
parents 35966741e45e
children 0b8efee7b549 90ba92820b26
files client/src/components/usermanagement/Userdetail.vue
diffstat 1 files changed, 15 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/usermanagement/Userdetail.vue	Fri Oct 22 20:11:19 2021 +0200
+++ b/client/src/components/usermanagement/Userdetail.vue	Mon Oct 25 16:19:13 2021 +0200
@@ -287,7 +287,10 @@
         isEmailValid(this.currentUser.email) &&
         this.currentUser.country &&
         this.password === this.passwordre &&
-        (this.password === "" || !violatedPasswordRules(this.password))
+        ((this.currentUser.active &&
+          (this.password === "" || !violatedPasswordRules(this.password))) ||
+          // Do not accept empty password by user-reactivation
+          (!this.currentUser.active && !violatedPasswordRules(this.password)))
       );
     }
   },
@@ -326,12 +329,21 @@
         this.password === this.passwordre
           ? ""
           : this.$gettext("Passwords do not match!");
-      this.errors.password =
-        this.password === "" || !violatedPasswordRules(this.password)
+      if (this.currentUser.active) {
+        this.errors.password =
+          this.password === "" || !violatedPasswordRules(this.password)
+            ? ""
+            : this.$gettext(
+                "Password should at least be 8 char long including 1 digit and 1 special char like $"
+              );
+      } else {
+        // Force entering password for user-reactivation
+        this.errors.password = !violatedPasswordRules(this.password)
           ? ""
           : this.$gettext(
               "Password should at least be 8 char long including 1 digit and 1 special char like $"
             );
+      }
     },
     validateEmailaddress() {
       this.errors.email = isEmailValid(this.currentUser.email)