I am trying to override the passwordResetToken view in the rogbregonm/yii2-auth package (github.com/robregonm/yii2-auth), which is used to send an email to the user.
The view is located in vendor/robregonm/yii2-auth/views/mail/passwordResetToken.php and the view I want to use is in frontend/themes/liva/vendor/auth/mail/passwordResetToken.php
I tried it in the main frontend configuration (advanced template):
(...)
'view' => [
'theme' => [
'pathMap' => [
'@frontend/views' => '@frontend/themes/liva',
'@vendor/robregonm/yii2-auth/views' => '@frontend/themes/liva/vendor/auth',
],
'baseUrl' => '@web/themes/liva',
],
],
(...)
This works fine for the views in the default folder of the package, but the mail view is ignored. It always sends the view from the package.
I also tried:
'@auth/views' => '@frontend/themes/liva/vendor/auth'
and
'@auth/views/mail/passwordResetToken' => '@frontend/themes/liva/vendor/auth/mail/passwordResetToken'
The code that sends the mail:
return \Yii::$app->mailer->compose('@auth/views/mail/passwordResetToken', ['user' => $user])
->setFrom([\Yii::$app->getModule('auth')->supportEmail => \Yii::$app->name])
->setTo($this->email)
->setSubject(Yii::t('auth.reset-password', 'Password reset for {name}', ['name' => \Yii::$app->name]))
->send();
Is there something wrong with my approach? Or another way to override the view?