Conditions | 4 |
Paths | 6 |
Total Lines | 31 |
Code Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | <?php |
||
39 | protected function sendEmail(BakaUsers $user, string $type): void |
||
40 | { |
||
41 | $send = true; |
||
42 | |||
43 | switch ($type) { |
||
44 | case 'recover': |
||
45 | $recoveryLink = $this->config->app->frontEndUrl . '/user/reset/' . $user->user_activation_forgot; |
||
46 | |||
47 | $subject = _('Password Recovery'); |
||
48 | $body = sprintf(_('Click %shere%s to set a new password for your account.'), '<a href="' . $recoveryLink . '" target="_blank">', '</a>'); |
||
49 | |||
50 | // send email to recover password |
||
51 | break; |
||
52 | case 'reset': |
||
53 | $activationUrl = $this->config->app->frontEndUrl . '/user/activate/' . $user->user_activation_key; |
||
54 | |||
55 | $subject = _('Password Updated!'); |
||
56 | $body = sprintf(_('Your password was update please, use this link to activate your account: %sActivate account%s'), '<a href="' . $activationUrl . '">', '</a>'); |
||
57 | // send email that password was update |
||
58 | break; |
||
59 | default: |
||
60 | $send = false; |
||
61 | break; |
||
62 | } |
||
63 | |||
64 | if ($send) { |
||
65 | $this->mail |
||
66 | ->to($user->email) |
||
67 | ->subject($subject) |
||
68 | ->content($body) |
||
69 | ->sendNow(); |
||
70 | } |
||
73 |