mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
fixed send verification email
This commit is contained in:
parent
088e980c38
commit
71a7fcd6de
@ -356,7 +356,8 @@ export class StackClientInterface {
|
||||
}
|
||||
|
||||
async sendVerificationEmail(
|
||||
emailVerificationRedirectUrl: string,
|
||||
email: string,
|
||||
callbackUrl: string,
|
||||
session: InternalSession
|
||||
): Promise<KnownErrors["EmailAlreadyVerified"] | undefined> {
|
||||
const res = await this.sendClientRequestAndCatchKnownError(
|
||||
@ -367,7 +368,8 @@ export class StackClientInterface {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
emailVerificationRedirectUrl,
|
||||
email,
|
||||
callback_url: callbackUrl,
|
||||
}),
|
||||
},
|
||||
session,
|
||||
|
||||
@ -804,7 +804,10 @@ class _StackClientAppImpl<HasTokenStore extends boolean, ProjectId extends strin
|
||||
return app._updateClientUser(update, session);
|
||||
},
|
||||
sendVerificationEmail() {
|
||||
return app._sendVerificationEmail(session);
|
||||
if (!crud?.primary_email) {
|
||||
throw new StackAssertionError("User does not have a primary email");
|
||||
}
|
||||
return app._sendVerificationEmail(crud.primary_email, session);
|
||||
},
|
||||
updatePassword(options: { oldPassword: string, newPassword: string}) {
|
||||
return app._updatePassword(options, session);
|
||||
@ -904,8 +907,6 @@ class _StackClientAppImpl<HasTokenStore extends boolean, ProjectId extends strin
|
||||
}
|
||||
}
|
||||
|
||||
console.log("HIIIIIIIIIIIII", handlerName, url, new Error());
|
||||
|
||||
await this._redirectIfTrusted(url, options);
|
||||
}
|
||||
|
||||
@ -1097,9 +1098,9 @@ class _StackClientAppImpl<HasTokenStore extends boolean, ProjectId extends strin
|
||||
await this.redirectToAfterSignOut();
|
||||
}
|
||||
|
||||
protected async _sendVerificationEmail(session: InternalSession): Promise<KnownErrors["EmailAlreadyVerified"] | void> {
|
||||
protected async _sendVerificationEmail(email: string, session: InternalSession): Promise<KnownErrors["EmailAlreadyVerified"] | void> {
|
||||
const emailVerificationRedirectUrl = constructRedirectUrl(this.urls.emailVerification);
|
||||
return await this._interface.sendVerificationEmail(emailVerificationRedirectUrl, session);
|
||||
return await this._interface.sendVerificationEmail(email, emailVerificationRedirectUrl, session);
|
||||
}
|
||||
|
||||
protected async _updatePassword(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user