Skip to content

Commit 0a6cbc9

Browse files
committed
add auth mails
1 parent 85f0405 commit 0a6cbc9

File tree

3 files changed

+111
-0
lines changed

3 files changed

+111
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
.settings/
33
.project
44
vendor/
5+
.idea/
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
namespace Ubiquity\mailer\models;
3+
4+
use Ubiquity\utils\base\UASystem;
5+
6+
/**
7+
* Mailer Auth2FAMail
8+
*/
9+
class Auth2FAMail extends \Ubiquity\mailer\AbstractMail {
10+
11+
private string $code='';
12+
13+
/**
14+
*
15+
* {@inheritdoc}
16+
* @see \Ubiquity\mailer\AbstractMail::bodyText()
17+
*/
18+
public function bodyText() {
19+
return sprintf('>2FA code : %s',$this->code);
20+
}
21+
22+
/**
23+
*
24+
* {@inheritdoc}
25+
* @see \Ubiquity\mailer\AbstractMail::initialize()
26+
*/
27+
protected function initialize(){
28+
$this->subject = '2FA verification';
29+
}
30+
31+
/**
32+
*
33+
* {@inheritdoc}
34+
* @see \Ubiquity\mailer\AbstractMail::body()
35+
*/
36+
public function body() {
37+
return \sprintf('A sign in attempt requires further verification from %s on %s.<br>To complete the sign in, enter the verification code.<hr><h1>2FA verification code</h1><h2>%s</h2>',UASystem::getBrowserComplete(),UASystem::getPlatform(),$this->code);
38+
}
39+
40+
/**
41+
* @param string $code
42+
*/
43+
public function setCode(string $code): void {
44+
$this->code = $code;
45+
}
46+
47+
48+
49+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
namespace Ubiquity\mailer\models;
3+
4+
/**
5+
* Mailer AuthEmailValidationMail
6+
*/
7+
class AuthEmailValidationMail extends \Ubiquity\mailer\AbstractMail {
8+
9+
private string $url='';
10+
11+
private $expire;
12+
13+
/**
14+
*
15+
* {@inheritdoc}
16+
* @see \Ubiquity\mailer\AbstractMail::bodyText()
17+
*/
18+
public function bodyText() {
19+
return sprintf('Click the below link to confirm your email. The link will expire in %s: %s',$this->expire,$this->url);
20+
}
21+
22+
/**
23+
*
24+
* {@inheritdoc}
25+
* @see \Ubiquity\mailer\AbstractMail::initialize()
26+
*/
27+
protected function initialize(){
28+
$this->subject = 'Account creation';
29+
}
30+
31+
/**
32+
*
33+
* {@inheritdoc}
34+
* @see \Ubiquity\mailer\AbstractMail::body()
35+
*/
36+
public function body() {
37+
return \sprintf('Click the below link to confirm your email. The link will expire in %s.<hr><a href="%s">Confirm your email</a>',$this->expire,$this->url);
38+
}
39+
40+
/**
41+
* @param string $url
42+
*/
43+
public function setUrl(string $url): void {
44+
$this->url = $url;
45+
}
46+
47+
/**
48+
* @return mixed
49+
*/
50+
public function getExpire() {
51+
return $this->expire;
52+
}
53+
54+
/**
55+
* @param mixed $expire
56+
*/
57+
public function setExpire($expire): void {
58+
$this->expire = $expire;
59+
}
60+
61+
}

0 commit comments

Comments
 (0)