PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.15.5
GiveWP – Donation Plugin and Fundraising Platform v4.15.5
4.18.0 4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 All 257 releases
give / src / DonorDashboards / Tabs / EditProfileTab / PasswordRoute.php

PasswordRoute.php in GiveWP – Donation Plugin and Fundraising Platform 4.15.5, at src/DonorDashboards/Tabs/EditProfileTab/PasswordRoute.php

60 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\DonorDashboards\Tabs\EditProfileTab;
4
5 use Give\DonorDashboards\Helpers\SanitizeProfileData as SanitizeHelper;
6 use Give\DonorDashboards\Profile as Profile;
7 use Give\DonorDashboards\Tabs\Contracts\Route as RouteAbstract;
8 use WP_REST_Request;
9
10 /**
11 * @since 2.10.0
12 */
13 class PasswordRoute extends RouteAbstract
14 {
15
16 /**
17 * @inheritdoc
18 */
19 public function endpoint()
20 {
21 return 'password';
22 }
23
24 /**
25 * @inheritdoc
26 */
27 public function args()
28 {
29 return [
30 'newPassword' => [
31 'type' => 'string',
32 'required' => true,
33 'sanitize_callback' => 'sanitize_text_field',
34 ],
35 ];
36 }
37
38 /**
39 * Handles password update.
40 *
41 * @since 3.3.0
42 *
43 * @param WP_REST_Request $request
44 *
45 * @return array
46 *
47 */
48 public function handleRequest(WP_REST_Request $request)
49 {
50 wp_update_user([
51 'ID' => wp_get_current_user()->ID,
52 'user_pass' => $request->get_param('newPassword'),
53 ]);
54
55 return [
56 'success' => true,
57 ];
58 }
59 }
60