Skip to content

Commit

Permalink
Allow using the name in password-recovery e-mail
Browse files Browse the repository at this point in the history
  • Loading branch information
CatoTH committed Nov 23, 2024
1 parent 2f70ca6 commit 5b3bde1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions models/db/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -753,9 +753,13 @@ public function sendRecoveryMail(): void
$subject = \Yii::t('user', 'recover_mail_title');
$url = UrlHelper::createUrl(['user/recovery', 'email' => $this->email, 'code' => $recoveryToken]);
$url = UrlHelper::absolutizeLink($url);
$text = \Yii::t('user', 'recover_mail_body');
$replaces = ['%URL%' => $url, '%CODE%' => $recoveryToken];
MailTools::sendWithLog($type, null, $this->email, $this->id, $subject, $text, '', $replaces);
$text = str_replace(
['%NAME_GIVEN%', '%NAME_FAMILY%'],
[$this->getGivenNameWithFallback(), $this->getFamilyNameWithFallback()],
\Yii::t('user', 'recover_mail_body')
);
$noLogReplaces = ['%URL%' => $url, '%CODE%' => $recoveryToken];
MailTools::sendWithLog($type, null, $this->email, $this->id, $subject, $text, '', $noLogReplaces);
}

/**
Expand Down

0 comments on commit 5b3bde1

Please sign in to comment.