EmailNotConfirmedException not rendering the anchor '<a>' tag on checkout page
-
15-04-2021 - |
Question
I am using Magento2.3.5p1 and working to modify the message of email confirmation on checkout page by adding the link to resend confirmation link.
I have overridden the AccountManagement.php model from Magento_Customer and changed code as below :
$value = $this->customerUrl->getEmailConfirmationUrl($login['username']);
if ($customer->getConfirmation() && $this->isConfirmationRequired($customer))
{
throw new EmailNotConfirmedException(__('This account is not confirmed.'.
'<a target="_blank" href='.$value.'> Click here</a> to resend confirmation email.'));
}
The result is an error message on the frontend that has the literal text
"This account is not confirmed. <a href="http://localhost:8080/ch/customer/example/url">Click here</a> to resend confirmation email.
"
Which is obviously is NOT a clickable link. I want it to be a clickable link with message.
Anyone please guide me for the same.
No correct solution
OTHER TIPS
try this
throw new EmailNotConfirmedException(
__(
'This account is not confirmed. <a target="_blank" href="%1">Click here</a> to resend confirmation email.',
$value
)
);
still, maybe it would be a good idea to move this message to session messages.
LE: the exception messages are not rendered as HTML, suggestion to set the message in session should be a better option.