File tree Expand file tree Collapse file tree 3 files changed +33
-1
lines changed
app/code/Magento/Customer
dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Index Expand file tree Collapse file tree 3 files changed +33
-1
lines changed Original file line number Diff line number Diff line change 13
13
class ResetPasswordButton extends GenericButton implements ButtonProviderInterface
14
14
{
15
15
/**
16
+ * Retrieve button-specified settings
17
+ *
16
18
* @return array
17
19
*/
18
20
public function getButtonData ()
@@ -23,14 +25,19 @@ public function getButtonData()
23
25
$ data = [
24
26
'label ' => __ ('Reset Password ' ),
25
27
'class ' => 'reset reset-password ' ,
26
- 'on_click ' => sprintf ("location.href = '%s'; " , $ this ->getResetPasswordUrl ()),
28
+ 'data_attribute ' => [
29
+ 'url ' => $ this ->getResetPasswordUrl ()
30
+ ],
31
+ 'on_click ' => '' ,
27
32
'sort_order ' => 60 ,
28
33
];
29
34
}
30
35
return $ data ;
31
36
}
32
37
33
38
/**
39
+ * Get reset password url
40
+ *
34
41
* @return string
35
42
*/
36
43
public function getResetPasswordUrl ()
Original file line number Diff line number Diff line change @@ -44,4 +44,12 @@ define([
44
44
45
45
return false ;
46
46
} ) ;
47
+
48
+ $ ( '#resetPassword' ) . click ( function ( ) {
49
+ var url = $ ( '#resetPassword' ) . data ( 'url' ) ;
50
+
51
+ getForm ( url ) . appendTo ( 'body' ) . submit ( ) ;
52
+
53
+ return false ;
54
+ } ) ;
47
55
} ) ;
Original file line number Diff line number Diff line change @@ -43,6 +43,23 @@ public function testResetPasswordSuccess()
43
43
$ this ->assertRedirect ($ this ->stringStartsWith ($ this ->baseControllerUrl . 'edit ' ));
44
44
}
45
45
46
+ /**
47
+ * Checks reset password functionality cannot be performed with GET request
48
+ *
49
+ * @magentoConfigFixture current_store customer/password/limit_password_reset_requests_method 0
50
+ * @magentoConfigFixture current_store customer/password/min_time_between_password_reset_requests 0
51
+ * @magentoDataFixture Magento/Customer/_files/customer.php
52
+ */
53
+ public function testResetPasswordWithGet ()
54
+ {
55
+ $ this ->passwordResetRequestEventCreate (
56
+ \Magento \Security \Model \PasswordResetRequestEvent::CUSTOMER_PASSWORD_RESET_REQUEST
57
+ );
58
+ $ this ->getRequest ()->setPostValue (['customer_id ' => '1 ' ])->setMethod (HttpRequest::METHOD_GET );
59
+ $ this ->dispatch ('backend/customer/index/resetPassword ' );
60
+ $ this ->assertEquals ('noroute ' , $ this ->getRequest ()->getControllerName ());
61
+ }
62
+
46
63
/**
47
64
* Checks reset password functionality with default restrictive min time between
48
65
* password reset requests and customer reset request event.
You can’t perform that action at this time.
0 commit comments