PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.5.1
JetFormBuilder — Dynamic Blocks Form Builder v3.6.5.1
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 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / modules / actions-v2 / update-user / properties / user-compare-password-property.php
jetformbuilder / modules / actions-v2 / update-user / properties Last commit date
description-property.php 2 years ago display-name-property.php 2 years ago first-name-property.php 2 years ago last-name-property.php 2 years ago nick-name-property.php 2 years ago update-action.php 2 years ago user-compare-password-property.php 8 months ago user-confirm-password-property.php 2 years ago user-email-property.php 2 years ago user-id-property.php 2 years ago user-meta-property.php 2 years ago user-modifier.php 2 months ago user-nicename-property.php 2 years ago user-password-property.php 2 years ago user-role-property.php 2 months ago user-url-property.php 2 years ago
user-compare-password-property.php
62 lines
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\Actions\Methods\Exceptions\Modifier_Exclude_Property;
9 use Jet_Form_Builder\Exceptions\Action_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_Compare_Password_Property extends Base_Object_Property {
18
19 public function get_id(): string {
20 return 'compare_password';
21 }
22
23 public function get_label(): string {
24 return __( 'Compare with Current Password', 'jet-form-builder' );
25 }
26
27 /**
28 * @param string $key
29 * @param $value
30 * @param Abstract_Modifier $modifier
31 *
32 * @throws Action_Exception
33 */
34 public function do_before( string $key, $value, Abstract_Modifier $modifier ) {
35 $id = $modifier->get( 'ID' );
36 $user_id = $id->value;
37
38 if ( false === $id && false === $user_id ) {
39 throw new Action_Exception( 'internal_error' );
40 }
41
42 $user = get_user_by( 'ID', $user_id );
43
44 if ( ! is_a( $user, \WP_User::class ) ) {
45 // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped
46 throw new Action_Exception( 'internal_error', $user, $value );
47 }
48
49 if ( ! wp_check_password( $value, $user->user_pass, $user->ID ) ) {
50 throw new Action_Exception( 'incorrect_old_password' );
51 }
52 }
53
54 public function get_related(): array {
55 return array( 'ID' );
56 }
57
58 public function get_help(): string {
59 return __( 'Password comparison works correctly with the DEFAULT.PROCESS event.', 'jet-form-builder' );
60 }
61 }
62