@@ -141,7 +141,7 @@ export const SignInWithEmailStep = ({
|
|||||||
setIsVerifying(true);
|
setIsVerifying(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await authService.signInMagicLink(email, otp);
|
await authService.signInMagicLink(email, otp, false);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof BackendError) {
|
if (e instanceof BackendError) {
|
||||||
notify.error({
|
notify.error({
|
||||||
|
|||||||
@@ -109,7 +109,8 @@ export class AuthService extends Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async signInMagicLink(email: string, token: string) {
|
async signInMagicLink(email: string, token: string, byLink = true) {
|
||||||
|
const method = byLink ? 'magic-link' : 'otp';
|
||||||
try {
|
try {
|
||||||
await this.fetchService.fetch('/api/auth/magic-link', {
|
await this.fetchService.fetch('/api/auth/magic-link', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -120,10 +121,10 @@ export class AuthService extends Service {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.session.revalidate();
|
this.session.revalidate();
|
||||||
track.$.$.auth.signedIn({ method: 'magic-link' });
|
track.$.$.auth.signedIn({ method });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
track.$.$.auth.signInFail({
|
track.$.$.auth.signInFail({
|
||||||
method: 'magic-link',
|
method,
|
||||||
reason: e instanceof BackendError ? e.originError.name : 'unknown',
|
reason: e instanceof BackendError ? e.originError.name : 'unknown',
|
||||||
});
|
});
|
||||||
throw e;
|
throw e;
|
||||||
|
|||||||
@@ -439,7 +439,7 @@ type SplitViewActionControlType = 'menu' | 'indicator';
|
|||||||
type SplitViewActionType = 'open' | 'close' | 'move' | 'closeOthers';
|
type SplitViewActionType = 'open' | 'close' | 'move' | 'closeOthers';
|
||||||
|
|
||||||
type AuthArgs = {
|
type AuthArgs = {
|
||||||
method: 'password' | 'magic-link' | 'oauth';
|
method: 'password' | 'magic-link' | 'oauth' | 'otp';
|
||||||
provider?: string;
|
provider?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user