feat(dashboard, user): prefill invite email (#9016)
**What** - store invite email on the JWT invite token - prefill email in the invite form --- RESOLVES CC-125
This commit is contained in:
@@ -38,6 +38,7 @@ type DecodedInvite = {
|
||||
jti: any
|
||||
exp: string
|
||||
iat: number
|
||||
email: string
|
||||
}
|
||||
|
||||
export const Invite = () => {
|
||||
@@ -185,6 +186,7 @@ const InvalidView = () => {
|
||||
const CreateView = ({
|
||||
onSuccess,
|
||||
token,
|
||||
invite,
|
||||
}: {
|
||||
onSuccess: () => void
|
||||
token: string
|
||||
@@ -196,7 +198,7 @@ const CreateView = ({
|
||||
const form = useForm<z.infer<typeof CreateAccountSchema>>({
|
||||
resolver: zodResolver(CreateAccountSchema),
|
||||
defaultValues: {
|
||||
email: "",
|
||||
email: invite.email || "",
|
||||
first_name: "",
|
||||
last_name: "",
|
||||
password: "",
|
||||
|
||||
@@ -157,7 +157,7 @@ export default class UserModuleService
|
||||
expires_at: new Date().setMilliseconds(
|
||||
new Date().getMilliseconds() + this.config.expiresIn
|
||||
),
|
||||
token: this.generateToken({ id: invite.id }),
|
||||
token: this.generateToken({ id: invite.id, email: invite.email }),
|
||||
}
|
||||
})
|
||||
|
||||
@@ -316,7 +316,7 @@ export default class UserModuleService
|
||||
expires_at: new Date().setMilliseconds(
|
||||
new Date().getMilliseconds() + this.config.expiresIn
|
||||
),
|
||||
token: this.generateToken({ id: invite.id }),
|
||||
token: this.generateToken({ id: invite.id, email: invite.email }),
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user