فهرست منبع

Merge branch 'staging/fixes' into staging/sync

Kristan Kenney 5 سال پیش
والد
کامیت
5f00e27c02

+ 1 - 1
web/add/db/index.php

@@ -42,7 +42,7 @@ if (!empty($_POST['ok'])) {
 
 
     // Check password length
     // Check password length
     if (empty($_SESSION['error_msg'])) {
     if (empty($_SESSION['error_msg'])) {
-        if (!preg_match('/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/', $_POST['v_password'])) { $_SESSION['error_msg'] = __('Password does not match the minimum requirements'); }
+         if (!validate_password($_POST['v_password'])) { $_SESSION['error_msg'] = __('Password does not match the minimum requirements');}
     }
     }
 
 
     // Protect input
     // Protect input

+ 1 - 1
web/add/mail/index.php

@@ -123,7 +123,7 @@ if (!empty($_POST['ok_acc'])) {
     
     
     // Check password length
     // Check password length
     if (empty($_SESSION['error_msg']) && !empty($_POST['v_fwd_only']) ) {
     if (empty($_SESSION['error_msg']) && !empty($_POST['v_fwd_only']) ) {
-        if (!preg_match('/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/', $_POST['v_password'])) { $_SESSION['error_msg'] = __('Password does not match the minimum requirements'); }
+        if (!validate_password($_POST['v_password'])) { $_SESSION['error_msg'] = __('Password does not match the minimum requirements');}
     }
     }
 
 
     // Protect input
     // Protect input

+ 1 - 1
web/add/user/index.php

@@ -45,7 +45,7 @@ if (!empty($_POST['ok'])) {
 
 
     // Check password length
     // Check password length
     if (empty($_SESSION['error_msg'])) {
     if (empty($_SESSION['error_msg'])) {
-        if (!preg_match('/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/', $_POST['v_password'])) { $_SESSION['error_msg'] = __('Password does not match the minimum requirements'); }
+        if (!validate_password($_POST['v_password'])) { $_SESSION['error_msg'] = __('Password does not match the minimum requirements'); }
     }
     }
 
 
     // Protect input
     // Protect input

+ 2 - 2
web/edit/db/index.php

@@ -63,8 +63,8 @@ if (!empty($_POST['save'])) {
 
 
     // Change database password
     // Change database password
     if ((!empty($_POST['v_password'])) && (empty($_SESSION['error_msg']))) {
     if ((!empty($_POST['v_password'])) && (empty($_SESSION['error_msg']))) {
-        if (!preg_match('/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/', $_POST['v_password'])) { 
-            $_SESSION['error_msg'] = __('Password does not match the minimum requirements'); 
+        if (!validate_password($_POST['v_password'])) { 
+             $_SESSION['error_msg'] = __('Password does not match the minimum requirements');
         }else{ 
         }else{ 
             $v_password = tempnam("/tmp","vst");
             $v_password = tempnam("/tmp","vst");
             $fp = fopen($v_password, "w");
             $fp = fopen($v_password, "w");

+ 2 - 2
web/edit/mail/index.php

@@ -398,8 +398,8 @@ if ((!empty($_POST['save'])) && (!empty($_GET['domain'])) && (!empty($_GET['acco
 
 
     // Change password
     // Change password
     if ((!empty($_POST['v_password'])) && (empty($_SESSION['error_msg']))) {
     if ((!empty($_POST['v_password'])) && (empty($_SESSION['error_msg']))) {
-        if (!preg_match('/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/', $_POST['v_password'])) { 
-            $_SESSION['error_msg'] = __('Password does not match the minimum requirements'); 
+        if (!validate_password($_POST['v_password'])) { 
+            $_SESSION['error_msg'] = __('Password does not match the minimum requirements');
         }else{         
         }else{         
             $v_password = tempnam("/tmp","vst");
             $v_password = tempnam("/tmp","vst");
             $fp = fopen($v_password, "w");
             $fp = fopen($v_password, "w");

+ 3 - 1
web/edit/user/index.php

@@ -100,7 +100,9 @@ if (!empty($_POST['save'])) {
     if ((!empty($_POST['v_password'])) && (empty($_SESSION['error_msg']))) {
     if ((!empty($_POST['v_password'])) && (empty($_SESSION['error_msg']))) {
         // Check password length
         // Check password length
         $pw_len = strlen($_POST['v_password']);
         $pw_len = strlen($_POST['v_password']);
-        if (!preg_match('/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/', $_POST['v_password'])) { $_SESSION['error_msg'] = __('Password does not match the minimum requirements'); }
+        if (!validate_password($_POST['v_password'])) { 
+            $_SESSION['error_msg'] = __('Password does not match the minimum requirements');
+        } 
         if (empty($_SESSION['error_msg'])) {
         if (empty($_SESSION['error_msg'])) {
             $v_password = tempnam("/tmp","vst");
             $v_password = tempnam("/tmp","vst");
             $fp = fopen($v_password, "w");
             $fp = fopen($v_password, "w");

+ 8 - 0
web/inc/main.php

@@ -385,3 +385,11 @@ function backendtpl_with_webdomains() {
     }
     }
     return $backend_list;
     return $backend_list;
 }
 }
+/**
+ * Check if password is valid
+ *
+ * @return int; 1 / 0
+ */
+function validate_password($password){
+    return preg_match('/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(.){8,}$/', $password);
+}

+ 0 - 5
web/templates/reset2fa.html

@@ -49,11 +49,6 @@
                                                     <input tabindex="1" type="text" size="20px" style="width:240px" name="twofa" class="vst-input">
                                                     <input tabindex="1" type="text" size="20px" style="width:240px" name="twofa" class="vst-input">
                                                 </td>
                                                 </td>
                                             </tr>
                                             </tr>
-                                            <tr>
-                                                <td style="padding: 12px 0 0 2px;">
-                                                    <?php print __('RESET_NOTICE');?>
-                                                </td>
-                                            </tr>
                                             <tr>
                                             <tr>
                                                 <td style="padding: 20px 0 12px 0;">
                                                 <td style="padding: 20px 0 12px 0;">
                                                     <input tabindex="2" type="submit" value="<?php print __('Submit');?>" class="button">&nbsp;&nbsp;
                                                     <input tabindex="2" type="submit" value="<?php print __('Submit');?>" class="button">&nbsp;&nbsp;

+ 0 - 5
web/templates/reset_1.html

@@ -35,11 +35,6 @@
                                                     <input tabindex="1" type="text" size="20px" style="width:240px" name="email" class="vst-input">
                                                     <input tabindex="1" type="text" size="20px" style="width:240px" name="email" class="vst-input">
                                                 </td>
                                                 </td>
                                             </tr>
                                             </tr>
-                                            <tr>
-                                                <td style="padding: 12px 0 0 2px;">
-                                                    <?php print __('RESET_NOTICE');?>
-                                                </td>
-                                            </tr>
                                             <tr>
                                             <tr>
                                                 <td style="padding: 20px 0 12px 0;">
                                                 <td style="padding: 20px 0 12px 0;">
                                                     <input tabindex="2" type="submit" value="<?php print __('Submit');?>" class="button">&nbsp;&nbsp;
                                                     <input tabindex="2" type="submit" value="<?php print __('Submit');?>" class="button">&nbsp;&nbsp;