diff --git a/src/app/(auth)/(login)/login-with-username/page.tsx b/src/app/(auth)/(login)/login-with-username/page.tsx index 1bfe64e..fc96bd9 100644 --- a/src/app/(auth)/(login)/login-with-username/page.tsx +++ b/src/app/(auth)/(login)/login-with-username/page.tsx @@ -22,6 +22,7 @@ import toast from "react-hot-toast"; import { useAuthSessionRedirect } from "@/hooks/useAuthSessionRedirect"; import { useTranslation } from "react-i18next"; import LocalePageShell from "@/components/i18n/LocalePageShell"; +import { establishIdentityAtLogin } from "@/lib/e2ee"; function LoginWithUsername() { const { t, i18n } = useTranslation("common"); @@ -66,6 +67,12 @@ function LoginWithUsername() { { noToast: true } )) as IVerifyOtp; + // قبل از اینکه password از scope خارج بشه، کلیدِ E2EE رو زیرِ همین رمز + // بکآپ/بازیابی کن — best-effort، نباید جلویِ خودِ لاگین رو بگیره + if (response.id) { + void establishIdentityAtLogin(response.id, values.password); + } + const loggedIn = await completeLogin(router, response, { redirectTo: redirectPath, }); diff --git a/src/app/(auth)/(register)/register/password/page.tsx b/src/app/(auth)/(register)/register/password/page.tsx index f2be62a..690e8ce 100644 --- a/src/app/(auth)/(register)/register/password/page.tsx +++ b/src/app/(auth)/(register)/register/password/page.tsx @@ -17,6 +17,8 @@ import AuthNextButton from "@/components/auth/AuthNextButton"; import toast from "react-hot-toast"; import { useTranslation } from "react-i18next"; import LocalePageShell from "@/components/i18n/LocalePageShell"; +import { getStoredUserId } from "@/lib/auth/session"; +import { establishIdentityAtLogin } from "@/lib/e2ee"; function PasswordPage() { const { t } = useTranslation("common"); @@ -53,6 +55,9 @@ function PasswordPage() { (await request("POST", "/register/password", { new_password: values.password, })) as IVerifyOtp; + // اولین رمزِ عبورِ این کاربره — همین الان کلیدِ E2EE رو زیرش بکآپ بگیر + const userId = getStoredUserId(); + if (userId) void establishIdentityAtLogin(userId, values.password); router.push("/register/fullname"); } catch (err: any) { const message = diff --git a/src/app/(projects)/projects/specialists/page.tsx b/src/app/(projects)/projects/specialists/page.tsx index bfe7fdb..0f6516d 100644 --- a/src/app/(projects)/projects/specialists/page.tsx +++ b/src/app/(projects)/projects/specialists/page.tsx @@ -12,7 +12,7 @@ import Container from "@/components/elements/Container"; import LocalePageShell from "@/components/i18n/LocalePageShell"; import SpecialistCarousel from "@/components/projects/SpecialistCarousel"; import useAxios from "@/hooks/useAxios"; -import { buildStorageUrl } from "@/components/main/BaseUrl"; +import ProfileAvatar from "@/components/main/ProfileAvatar"; import { cn } from "@/lib/utils"; import { useTranslation } from "react-i18next"; import type { SuggestedFollowUser } from "@/components/posts/FollowingSuggestionsCarousel"; @@ -70,9 +70,6 @@ function SpecialistCard({ const media = user.previewPost ? getPostMedia(user.previewPost as Post) : null; - const profileUrl = user.profile_image - ? buildStorageUrl(user.profile_image) - : null; const isMain = variant === "main"; const profileHref = user.user_name ? `/users/${user.user_name}` : "#"; @@ -130,25 +127,13 @@ function SpecialistCard({ isMain ? "px-4 pb-5" : "px-2 pb-3" )} > -
{msg.replyTo.content}
++ {msg.replyTo.content === E2EE_LOCKED_PREVIEW + ? "" + : msg.replyTo.content} +
) : null}- {msg.content} + {bubbleContent}
) : null} @@ -328,6 +340,8 @@ export default function ChatRoomThreadPage({ const { request } = useAxios(); const router = useRouter(); const user = useUser(); + const [socialSignupOpen, setSocialSignupOpen] = useState(false); + const pendingSendRetryRef = useRef<(() => void) | null>(null); const [room, setRoom] = useState{name}
diff --git a/src/app/settings/edit/page.tsx b/src/app/settings/edit/page.tsx
index 002cc6c..31ceda7 100644
--- a/src/app/settings/edit/page.tsx
+++ b/src/app/settings/edit/page.tsx
@@ -16,6 +16,7 @@ const EDIT_NAV_KEY: Record
+ {t("settings.edit.registerMobile.hint")}
+ {t("common.loading")} {t("subUsers.nameLabel")} {t("subUsers.lastNameLabel")} {t("subUsers.usernameLabel")} {t("subUsers.passwordLabel")} {t("subUsers.permissionsLabel")} {name} @{subUser.user_name} {t("subUsers.permissionsTitle")} {t(`subUsers.permissions.${key}`)} {t("subUsers.nameLabel")} {t("subUsers.lastNameLabel")} {t("subUsers.usernameLabel")} {t("subUsers.passwordLabel")} {t("subUsers.permissionsLabel")} {t("common.loading")} {name} @{su.user_name}
+ برای امنیت گفتگوهاتون، یک نام کاربری و رمز عبور تنظیم کنید
+ {usernameError} {passwordError} {message.replyTo.content}
+ {getBubbleTextContent(message.replyTo.content)}
+ {t("chats.e2ee.recoveryTitle")}
- {state.hasBackup
- ? t("chats.e2ee.recoveryHasBackupDesc")
- : t("chats.e2ee.recoveryNoBackupDesc")}
- {error}
- {t("chats.e2ee.confirmFreshWarning")}
- {t("posts.postWasDeleted")}
+ ) : (
+
+ )}
+
+ ) : (
+
+ )}
+
+ تکمیل حساب کاربری
+
+