File tree 1 file changed +10
-8
lines changed
app/code/Magento/CustomerGraphQl/Model/Resolver/Customer/Account
1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -62,22 +62,24 @@ public function resolve(
62
62
array $ value = null ,
63
63
array $ args = null
64
64
) {
65
- $ customerId = $ this ->userContext ->getUserId ();
65
+ if (!isset ($ args ['currentPassword ' ])) {
66
+ throw new GraphQlInputException (__ ('"currentPassword" value should be specified ' ));
67
+ }
68
+
69
+ if (!isset ($ args ['newPassword ' ])) {
70
+ throw new GraphQlInputException (__ ('"newPassword" value should be specified ' ));
71
+ }
66
72
67
- if ($ customerId === 0 || $ customerId === null ) {
73
+ $ customerId = (int )$ this ->userContext ->getUserId ();
74
+ if ($ customerId === 0 ) {
68
75
throw new GraphQlAuthorizationException (
69
76
__ (
70
77
'Current customer does not have access to the resource "%1" ' ,
71
78
[Customer::ENTITY ]
72
79
)
73
80
);
74
81
}
75
- if (!isset ($ args ['currentPassword ' ])) {
76
- throw new GraphQlInputException (__ ('"currentPassword" value should be specified ' ));
77
- }
78
- if (!isset ($ args ['newPassword ' ])) {
79
- throw new GraphQlInputException (__ ('"newPassword" value should be specified ' ));
80
- }
82
+
81
83
$ this ->accountManagement ->changePasswordById ($ customerId , $ args ['currentPassword ' ], $ args ['newPassword ' ]);
82
84
$ data = $ this ->customerResolver ->getCustomerById ($ customerId );
83
85
You can’t perform that action at this time.
0 commit comments