Skip to content

Commit 5f00e27

Browse files
author
Kristan Kenney
committed
Merge branch 'staging/fixes' into staging/sync
2 parents 685fe45 + 31d8a73 commit 5f00e27

File tree

9 files changed

+18
-18
lines changed

9 files changed

+18
-18
lines changed

web/add/db/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
// Check password length
4444
if (empty($_SESSION['error_msg'])) {
45-
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'); }
45+
if (!validate_password($_POST['v_password'])) { $_SESSION['error_msg'] = __('Password does not match the minimum requirements');}
4646
}
4747

4848
// Protect input

web/add/mail/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123

124124
// Check password length
125125
if (empty($_SESSION['error_msg']) && !empty($_POST['v_fwd_only']) ) {
126-
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'); }
126+
if (!validate_password($_POST['v_password'])) { $_SESSION['error_msg'] = __('Password does not match the minimum requirements');}
127127
}
128128

129129
// Protect input

web/add/user/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
// Check password length
4747
if (empty($_SESSION['error_msg'])) {
48-
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'); }
48+
if (!validate_password($_POST['v_password'])) { $_SESSION['error_msg'] = __('Password does not match the minimum requirements'); }
4949
}
5050

5151
// Protect input

web/edit/db/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@
6363

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

web/edit/mail/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,8 @@
398398

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

web/edit/user/index.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@
100100
if ((!empty($_POST['v_password'])) && (empty($_SESSION['error_msg']))) {
101101
// Check password length
102102
$pw_len = strlen($_POST['v_password']);
103-
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'); }
103+
if (!validate_password($_POST['v_password'])) {
104+
$_SESSION['error_msg'] = __('Password does not match the minimum requirements');
105+
}
104106
if (empty($_SESSION['error_msg'])) {
105107
$v_password = tempnam("/tmp","vst");
106108
$fp = fopen($v_password, "w");

web/inc/main.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,3 +385,11 @@ function backendtpl_with_webdomains() {
385385
}
386386
return $backend_list;
387387
}
388+
/**
389+
* Check if password is valid
390+
*
391+
* @return int; 1 / 0
392+
*/
393+
function validate_password($password){
394+
return preg_match('/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(.){8,}$/', $password);
395+
}

web/templates/reset2fa.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,6 @@
4949
<input tabindex="1" type="text" size="20px" style="width:240px" name="twofa" class="vst-input">
5050
</td>
5151
</tr>
52-
<tr>
53-
<td style="padding: 12px 0 0 2px;">
54-
<?php print __('RESET_NOTICE');?>
55-
</td>
56-
</tr>
5752
<tr>
5853
<td style="padding: 20px 0 12px 0;">
5954
<input tabindex="2" type="submit" value="<?php print __('Submit');?>" class="button">&nbsp;&nbsp;

web/templates/reset_1.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@
3535
<input tabindex="1" type="text" size="20px" style="width:240px" name="email" class="vst-input">
3636
</td>
3737
</tr>
38-
<tr>
39-
<td style="padding: 12px 0 0 2px;">
40-
<?php print __('RESET_NOTICE');?>
41-
</td>
42-
</tr>
4338
<tr>
4439
<td style="padding: 20px 0 12px 0;">
4540
<input tabindex="2" type="submit" value="<?php print __('Submit');?>" class="button">&nbsp;&nbsp;

0 commit comments

Comments
 (0)