File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
app/code/Magento/Customer/Controller/Account Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -525,18 +525,19 @@ private function getMessageManagerSuccessMessage(): MessageInterface
525
525
private function decodePunycodeEmail (): void
526
526
{
527
527
$ email = $ this ->getRequest ()->getParam ('email ' );
528
+ if (!$ email || strpos ($ email , '@ ' ) === false ) {
529
+ return ;
530
+ }
528
531
529
532
// Split local part and domain
530
533
[$ localPart , $ domain ] = explode ('@ ' , $ email , 2 );
531
534
532
- // Decode only the domain part
533
- if (function_exists ('idn_to_utf8 ' )) {
535
+ // Only decode if domain contains punycode (contains 'xn--')
536
+ if (function_exists ('idn_to_utf8 ' ) && strpos ( $ domain , ' xn-- ' ) !== false ) {
534
537
$ decodedDomain = idn_to_utf8 ($ domain , IDNA_DEFAULT , INTL_IDNA_VARIANT_UTS46 );
535
- if ($ decodedDomain !== false ) {
536
- $ domain = $ decodedDomain ;
538
+ if ($ decodedDomain !== false && $ decodedDomain !== $ domain ) {
539
+ $ this -> getRequest ()-> setParam ( ' email ' , $ localPart . ' @ ' . $ decodedDomain) ;
537
540
}
538
541
}
539
-
540
- $ this ->getRequest ()->setParam ('email ' , $ localPart . '@ ' . $ domain );
541
542
}
542
543
}
You can’t perform that action at this time.
0 commit comments