PluginProbe
Contact Forms by Cimatti / 1.9.2
Contact Forms by Cimatti v1.9.2
2.3.6 2.3.5 2.3.0 2.2.32 2.2.4 2.2.0 2.1.2 2.1.1 trunk 1.0 1.1 1.2 1.2.1 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 All 62 releases
← All changes | classes/Validation/Password.php +23 -31 1.3.81.9.2 View file →
@@ -1,31 +1,23 @@
1 -<?php
2 -class AccuaForm_Validation_Password extends Validation {
3 - public function __construct($message = "") {
4 - if(empty($message)) {
5 - $this->message = __("Attention: Your passwords do not match.", 'accua-form-api');
6 - } else {
7 - $this->message = $message;
8 - }
9 - }
10 -
11 - public function isValid($value) {
12 - $valid = false;
13 -
14 -
15 - foreach ($_POST as $key => $value)
16 - if(preg_match("/___([a-zA-Z0-9-_]+)___confirmpass/i",$key,$matches))
17 - {
18 - $slug_password=$matches[1];
19 - $value_confirm_pass=$value;
20 - break;
21 - }
22 -
23 - foreach ($_POST as $key => $value)
24 - if($key==$slug_password)
25 - $value_pass=$value;
26 -
27 - if($value_pass == $value_confirm_pass){
28 - $valid = true; }
29 - return $valid;
30 - }
31 -}
1 +<?php
2 +class AccuaForm_Validation_Password extends Validation {
3 + protected $otherPasswordFieldName = '';
4 +
5 + public function __construct($message = "") {
6 + if(empty($message)) {
7 + $this->message = __("Attention: Your passwords do not match.", 'contact-forms');
8 + } else {
9 + $this->message = $message;
10 + }
11 + }
12 +
13 + public function isValid($value) {
14 + $valid = false;
15 + if ($this->otherPasswordFieldName !== '') {
16 + if (isset($_POST[$this->otherPasswordFieldName])) {
17 + $otherValue = stripslashes((string) $_POST[$this->otherPasswordFieldName]);
18 + $valid = $value === $otherValue;
19 + }
20 + }
21 + return $valid;
22 + }
23 +}