Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F995214
password-reset.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
929 B
Referenced Files
None
Subscribers
None
password-reset.ts
View Options
import
{
EmailTemplates
,
Errors
}
from
"sealious"
;
import
type
TheApp
from
"../app.js"
;
export
default
async
function
PasswordResetTemplate
(
app
:
TheApp
,
{
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
Errors
.
NotFound
(
"No user with that email"
);
}
const
username
=
matching_users
.
items
[
0
].
get
(
"username"
);
return
EmailTemplates
.
Simple
(
app
,
{
subject
:
app
.
i18n
(
"password_reset_email_subject"
,
[
app
.
manifest
.
name
]),
to
:
`
${
String
(
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
Mon, Dec 23, 00:54 (4 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
556718
Default Alt Text
password-reset.ts (929 B)
Attached To
Mode
rPLAY Sealious playground
Attached
Detach File
Event Timeline
Log In to Comment