Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F10314424
password-reset-intents.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
password-reset-intents.ts
View Options
import
PasswordResetTemplate
from
"../../email/templates/password-reset"
;
import
{
App
,
Collection
,
CollectionItem
,
Context
,
FieldTypes
,
Policies
,
}
from
"../../main"
;
export
default
class
PasswordResetIntents
extends
Collection
{
name
=
"password-reset-intents"
;
fields
=
{
email
:
new
FieldTypes
.
ValueExistingInCollection
({
field
:
"email"
,
collection
:
"users"
,
include_forbidden
:
true
,
}),
token
:
new
FieldTypes
.
SecretToken
(),
};
policies
=
{
create
:
new
Policies
.
Public
(),
edit
:
new
Policies
.
Noone
(),
};
defaultPolicy
:
Policies
.
Super
;
async
init
(
app
:
App
,
name
:
string
)
{
await
super
.
init
(
app
,
name
);
app
.
collections
[
"password-reset-intents"
].
on
(
"after:create"
,
async
([
context
,
intent
]
:
[
Context
,
CollectionItem
<
PasswordResetIntents
>
,
any
])
=>
{
const
intent_as_super
=
await
intent
.
fetchAs
(
new
app
.
SuperContext
()
);
const
message
=
await
PasswordResetTemplate
(
app
,
{
email_address
:
intent
.
get
(
"email"
),
token
:
intent_as_super
.
get
(
"token"
),
});
await
message
.
send
(
app
);
}
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Sat, Nov 1, 16:05 (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1004257
Default Alt Text
password-reset-intents.ts (1 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment