feat(auth): add psid field to various login request DTOs and schemas
This commit is contained in:
@@ -12,7 +12,7 @@ import { UserStorage } from "@/data/storage/user/user_storage";
|
||||
import { deviceIdentifier, Logger, Result } from "@/utils";
|
||||
import { hasCompleteBusinessAuthSession } from "@/lib/auth/auth_session";
|
||||
|
||||
import { readGuestId } from "./auth-helpers";
|
||||
import { readGuestId, readPsid } from "./auth-helpers";
|
||||
|
||||
const log = new Logger("AuthActors");
|
||||
|
||||
@@ -25,10 +25,12 @@ export const emailLoginActor = fromPromise<LoginStatus, { email: string; passwor
|
||||
passwordLength: input.password.length,
|
||||
});
|
||||
const guestId = await readGuestId();
|
||||
const psid = await readPsid();
|
||||
log.debug("[auth-machine] emailLoginActor calling authRepo.emailLogin", {
|
||||
hasGuestId: !!guestId,
|
||||
hasPsid: !!psid,
|
||||
});
|
||||
const result = await authRepo.emailLogin({ ...input, guestId });
|
||||
const result = await authRepo.emailLogin({ ...input, guestId, psid });
|
||||
log.debug("[auth-machine] emailLoginActor authRepo.emailLogin DONE", {
|
||||
success: result.success,
|
||||
hasData: result.success ? !!result.data : null,
|
||||
@@ -62,6 +64,7 @@ export const emailRegisterThenLoginActor = fromPromise<
|
||||
});
|
||||
if (Result.isErr(registerResult)) throw registerResult.error;
|
||||
|
||||
const psid = await readPsid();
|
||||
// 注册后自动登录(对齐 Dart 行为)
|
||||
log.debug(
|
||||
"[auth-machine] emailRegisterThenLoginActor calling authRepo.emailLogin (post-register)",
|
||||
@@ -70,6 +73,7 @@ export const emailRegisterThenLoginActor = fromPromise<
|
||||
email: input.email,
|
||||
password: input.password,
|
||||
guestId,
|
||||
psid,
|
||||
});
|
||||
log.debug(
|
||||
"[auth-machine] emailRegisterThenLoginActor authRepo.emailLogin DONE",
|
||||
@@ -110,9 +114,11 @@ export const syncGoogleBackendActor = fromPromise<LoginStatus, { idToken: string
|
||||
async ({ input }) => {
|
||||
const authRepo = getAuthRepository();
|
||||
const guestId = await readGuestId();
|
||||
const psid = await readPsid();
|
||||
const result = await authRepo.googleLogin({
|
||||
idToken: input.idToken,
|
||||
guestId,
|
||||
psid,
|
||||
});
|
||||
if (Result.isErr(result)) throw result.error;
|
||||
return "google" as LoginStatus;
|
||||
@@ -125,9 +131,11 @@ export const syncFacebookBackendActor = fromPromise<
|
||||
>(async ({ input }) => {
|
||||
const authRepo = getAuthRepository();
|
||||
const guestId = await readGuestId();
|
||||
const psid = await readPsid();
|
||||
const result = await authRepo.facebookLogin({
|
||||
accessToken: input.accessToken,
|
||||
guestId,
|
||||
psid,
|
||||
});
|
||||
if (Result.isErr(result)) throw result.error;
|
||||
|
||||
@@ -252,9 +260,11 @@ export const checkAuthStatusActor = fromPromise<LoginStatus, void>(async () => {
|
||||
if (asidR.success && asidR.data) {
|
||||
const authRepo = getAuthRepository();
|
||||
const avatarUrlR = await UserStorage.getInstance().getAvatarUrl();
|
||||
const psid = await readPsid();
|
||||
const result = await authRepo.facebookIdLogin({
|
||||
fbId: asidR.data,
|
||||
avatarUrl: avatarUrlR.success ? avatarUrlR.data ?? undefined : undefined,
|
||||
psid,
|
||||
});
|
||||
|
||||
if (Result.isErr(result)) {
|
||||
|
||||
Reference in New Issue
Block a user