Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F120836651
PasswordReset.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
PasswordReset.php
View Options
<?php
namespace
App\Mail
;
use
App\Tenant
;
use
App\User
;
use
App\Utils
;
use
App\VerificationCode
;
use
Illuminate\Support\Str
;
class
PasswordReset
extends
Mailable
{
/** @var \App\VerificationCode A verification code object */
protected
$code
;
/**
* Create a new message instance.
*
* @param \App\VerificationCode $code A verification code object
*
* @return void
*/
public
function
__construct
(
VerificationCode
$code
)
{
$this
->
code
=
$code
;
$this
->
user
=
$this
->
code
->
user
;
}
/**
* Build the message.
*
* @return $this
*/
public
function
build
()
{
$appName
=
Tenant
::
getConfig
(
$this
->
user
->
tenant_id
,
'app.name'
);
$href
=
Utils
::
serviceUrl
(
sprintf
(
'/password-reset/%s-%s'
,
$this
->
code
->
short_code
,
$this
->
code
->
code
),
$this
->
user
->
tenant_id
);
$vars
=
[
'email'
=>
$this
->
user
->
email
,
'name'
=>
$this
->
user
->
name
(
true
),
'site'
=>
$appName
,
];
$this
->
view
(
'emails.html.password_reset'
)
->
text
(
'emails.plain.password_reset'
)
->
subject
(
\trans
(
'mail.passwordreset-subject'
,
$vars
))
->
with
([
'vars'
=>
$vars
,
'link'
=>
sprintf
(
'<a href="%s">%s</a>'
,
$href
,
$href
),
'code'
=>
$this
->
code
->
code
,
'short_code'
=>
$this
->
code
->
short_code
,
]);
return
$this
;
}
/**
* Render the mail template with fake data
*
* @param string $type Output format ('html' or 'text')
*
* @return string HTML or Plain Text output
*/
public
static
function
fakeRender
(
string
$type
=
'html'
):
string
{
$code
=
new
VerificationCode
([
'code'
=>
Str
::
random
(
VerificationCode
::
CODE_LENGTH
),
'short_code'
=>
VerificationCode
::
generateShortCode
(),
]);
// @phpstan-ignore-next-line
$code
->
user
=
new
User
([
'email'
=>
'test@'
.
\config
(
'app.domain'
),
]);
$mail
=
new
self
(
$code
);
return
Helper
::
render
(
$mail
,
$type
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Apr 24, 1:33 PM (1 d, 22 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18846294
Default Alt Text
PasswordReset.php (2 KB)
Attached To
Mode
rK kolab
Attached
Detach File
Event Timeline