Skip to content

Commit

Permalink
Added support for different email template based on the method used
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisOuellet committed Apr 9, 2024
1 parent a4a037a commit 5b5869a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Objects/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ public function send2FACode(){

// Send Code
foreach($this->get('2FAMethod') as $Method){
$this->sendCode($Code, $Method);
$this->sendCode($Code, $Method, "send2FACode");
}

// Return
Expand Down Expand Up @@ -463,7 +463,7 @@ public function sendVerificationCode(){
$this->save($User);

// Send code
$this->sendCode($Code, "smtp");
$this->sendCode($Code, "smtp", "sendVerificationCode");

// Return
return $this;
Expand All @@ -485,7 +485,7 @@ public function sendVerificationCode(){
* @return object|void
* @throws Exception
*/
private function sendCode($Code, $Method){
private function sendCode($Code, $Method, $Template = 'default'){
try{

// Send Code
Expand All @@ -503,8 +503,8 @@ private function sendCode($Code, $Method){
}

// Add and Set default template
if($this->SMTP->addTemplate('sendCode',$this->Configurator->root() . '/Mail/sendCode.html')){
$this->SMTP->setTemplate('sendCode');
if($this->SMTP->addTemplate($Template,$this->Configurator->root() . '/Mail/' . $Template . '.html')){
$this->SMTP->setTemplate($Template);
}

// Send Code
Expand Down

0 comments on commit 5b5869a

Please sign in to comment.