PluginProbe
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.5.2
JetFormBuilder — Dynamic Blocks Form Builder v3.6.5.2
3.6.5.2 3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 All 130 releases
jetformbuilder / modules / actions-v2 / update-user / properties / user-password-property.php
user-password-property.php
58 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3
4 namespace JFB_Modules\Actions_V2\Update_User\Properties;
5
6 use Jet_Form_Builder\Actions\Methods\Abstract_Modifier;
7 use Jet_Form_Builder\Actions\Methods\Base_Object_Property;
8 use Jet_Form_Builder\Exceptions\Action_Exception;
9 use Jet_Form_Builder\Exceptions\Handler_Exception;
10 use Jet_Form_Builder\Exceptions\Silence_Exception;
11
12 // If this file is called directly, abort.
13 if ( ! defined( 'WPINC' ) ) {
14 die;
15 }
16
17 class User_Password_Property extends Base_Object_Property {
18
19 public function get_id(): string {
20 return 'password';
21 }
22
23 public function get_attach_id(): string {
24 return 'user_pass';
25 }
26
27 public function get_label(): string {
28 return __( 'Password', 'jet-form-builder' );
29 }
30
31 /**
32 * @param string $key
33 * @param $value
34 * @param Abstract_Modifier $modifier
35 *
36 * @throws Action_Exception
37 */
38 public function do_before( string $key, $value, Abstract_Modifier $modifier ) {
39 $this->value = wp_check_invalid_utf8( $value, true );
40 $confirm = $modifier->get( 'confirm_password' );
41
42 if ( is_null( $confirm->value ) ) {
43 return;
44 }
45
46 $confirm = wp_check_invalid_utf8( $confirm->value, true );
47
48 if ( $confirm !== $this->value ) {
49 throw new Action_Exception( 'password_mismatch' );
50 }
51 }
52
53 public function get_related(): array {
54 return array( 'confirm_password' );
55 }
56
57 }
58