| @@ -2,12 +2,10 @@ | ||
| 2 | 2 | if (!defined('ABSPATH')) exit; |
| 3 | 3 | if (!class_exists('WPRWP2FAEmailOTPSender')) : |
| 4 | 4 | class WPRWP2FAEmailOTPSender { |
| 5 | 5 | public static function send($user, $code, $lifetime) { |
| 6 | - $site_name = wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES); | |
| 7 | - $minutes = max(1, intval(round($lifetime / MINUTE_IN_SECONDS))); | |
| 8 | - $subject = sprintf('Your sign-in code for %s', $site_name); | |
| 9 | - $message = sprintf("Your sign-in code is %s.\n\nSite: %s (%s)\nThis code expires in %d minutes.\n\nIf you did not request this code, you can ignore this email and review your account security.", $code, $site_name, home_url('/'), $minutes); | |
| 10 | - return wp_mail($user->user_email, $subject, $message); | |
| 6 | + $template = new WPRWP2FAEmailOTPTemplate($code, $lifetime); | |
| 7 | + | |
| 8 | + return wp_mail($user->user_email, $template->subject(), $template->body(), $template->headers()); | |
| 11 | 9 | } |
| 12 | 10 | } |
| 13 | 11 | endif; |