File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
app/code/Magento/Newsletter/Controller/Subscriber
dev/tests/integration/testsuite/Magento/Newsletter/Controller Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -77,9 +77,10 @@ public function __construct(
77
77
protected function validateEmailAvailable ($ email )
78
78
{
79
79
$ websiteId = $ this ->_storeManager ->getStore ()->getWebsiteId ();
80
- if ($ this ->_customerSession ->getCustomerDataObject ()->getEmail () !== $ email
80
+ if ($ this ->_customerSession ->isLoggedIn ()
81
+ && ($ this ->_customerSession ->getCustomerDataObject ()->getEmail () !== $ email
81
82
&& !$ this ->customerAccountManagement ->isEmailAvailable ($ email , $ websiteId )
82
- ) {
83
+ )) {
83
84
throw new LocalizedException (
84
85
__ ('This email address is already assigned to another user. ' )
85
86
);
Original file line number Diff line number Diff line change @@ -53,11 +53,10 @@ public function testNewActionUsedEmail()
53
53
$ this ->getRequest ()->setPostValue ([
54
54
'email ' => 'customer@example.com ' ,
55
55
]);
56
-
57
56
$ this ->dispatch ('newsletter/subscriber/new ' );
58
57
59
58
$ this ->assertSessionMessages ($ this ->equalTo ([
60
- 'There was a problem with the subscription: This email address is already assigned to another user . ' ,
59
+ 'Thank you for your subscription. ' ,
61
60
]));
62
61
$ this ->assertRedirect ($ this ->anything ());
63
62
}
You can’t perform that action at this time.
0 commit comments