2fa by email and by sms
This commit is contained in:
@ -114,6 +114,28 @@ class MailFactory
|
||||
return static::makeMailerService(MailEvent::TYPE_RECONFIRM, $from, $to, $subject, 'reconfirmation', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
* @param String $code
|
||||
*
|
||||
* @throws InvalidConfigException
|
||||
* @return MailService
|
||||
*/
|
||||
public static function makeTwoFactorCodeMailerService(User $user, String $code)
|
||||
{
|
||||
/** @var Module $module */
|
||||
$module = Yii::$app->getModule('user');
|
||||
$to = $user->email;
|
||||
|
||||
$from = $module->mailParams['fromEmail'];
|
||||
$subject = $module->mailParams['reconfirmationMailSubject'];
|
||||
$params = [
|
||||
'code' => $code,
|
||||
];
|
||||
|
||||
return static::makeMailerService(MailEvent::TYPE_TWOFACTORCODE, $from, $to, $subject, 'twofactorcode', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a MailerService.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user