Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F4637615
password-reset.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
948 B
Referenced Files
None
Subscribers
None
password-reset.ts
View Options
import
SimpleTemplate
from
"./simple"
;
import
{
App
}
from
"../../main"
;
import
{
NotFound
}
from
"../../response/errors"
;
export
default
async
function
PasswordResetTemplate
(
app
:
App
,
{
email_address
,
token
}
:
{
email_address
:
string
;
token
:
string
}
)
{
const
matching_users
=
await
app
.
collections
.
users
.
suList
()
.
filter
({
email
:
email_address
})
.
fetch
();
if
(
!
matching_users
.
items
.
length
)
{
throw
new
NotFound
(
"No user with that email"
);
}
const
username
=
matching_users
.
items
[
0
].
get
(
"username"
);
return
SimpleTemplate
(
app
,
{
subject
:
app
.
i18n
(
"password_reset_email_subject"
,
app
.
manifest
.
name
),
to
:
`
${
username
}
<
${
email_address
}
>`
,
text
:
`
${
app
.
i18n
(
"password_reset_email_text"
,
[
app
.
manifest
.
name
,
username
,
])
}
`
,
buttons
:
[
{
text
:
app
.
i18n
(
"password_reset_cta"
),
href
:
`
${
app
.
manifest
.
base_url
}
/confirm-password-reset?token=
${
token
}
&email=
${
email_address
}
`
,
},
],
});
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Tue, May 27, 23:48 (1 d, 17 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
656520
Default Alt Text
password-reset.ts (948 B)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment