Password security policy (#4765)

* Psw (#4748)

* feat: 添加重置密码功能及相关接口

- 在用户模型中新增 passwordUpdateTime 字段以记录密码更新时间。
- 更新用户模式以支持密码更新时间的存储。
- 新增重置密码的模态框组件,允许用户重置密码。
- 实现重置密码的 API 接口,支持根据用户 ID 更新密码。
- 更新相关国际化文件,添加重置密码的提示信息。

* 更新国际化文件,添加重置密码相关提示信息,并优化重置密码模态框的实现。修复部分代码逻辑,确保用户体验流畅。

* 更新国际化文件,添加重置密码相关提示信息,优化重置密码模态框的实现,修复部分代码逻辑,确保用户体验流畅。新增获取用户密码更新时间的API接口,并调整相关逻辑以支持密码重置功能。

* update

* fix

* fix

* Added environment variables NEXT_PUBLIC_PASSWORD_UPDATETIME to support password update time configuration, update related logic to implement password mandatory update function, and optimize the implementation of reset password modal box to improve user experience.

* update index

* 更新用户密码重置功能,调整相关API接口,优化重置密码模态框的实现,确保用户体验流畅。修复部分代码逻辑,更新国际化提示信息。

* 删除获取用户密码更新时间的API接口,并在布局组件中移除不必要的重置密码模态框。优化代码结构,提升可维护性。

* update

* perf: reset expired password code

* perf: layout child components

* doc

* remove invalid env

* perf: update password code

---------

Co-authored-by: dreamer6680 <1468683855@qq.com>
This commit is contained in:
Archer
2025-05-08 12:11:08 +08:00
committed by GitHub
parent 96e7dd581e
commit c75f154728
24 changed files with 818 additions and 550 deletions

View File

@@ -18,12 +18,26 @@ import WorkorderButton from './WorkorderButton';
const Navbar = dynamic(() => import('./navbar'));
const NavbarPhone = dynamic(() => import('./navbarPhone'));
const NotSufficientModal = dynamic(() => import('@/components/support/wallet/NotSufficientModal'));
const SystemMsgModal = dynamic(() => import('@/components/support/user/inform/SystemMsgModal'));
const ImportantInform = dynamic(() => import('@/components/support/user/inform/ImportantInform'));
const UpdateContact = dynamic(() => import('@/components/support/user/inform/UpdateContactModal'));
const ManualCopyModal = dynamic(() =>
import('@fastgpt/web/hooks/useCopyData').then((mod) => mod.ManualCopyModal)
const ResetExpiredPswModal = dynamic(
() => import('@/components/support/user/safe/ResetExpiredPswModal'),
{ ssr: false }
);
const NotSufficientModal = dynamic(() => import('@/components/support/wallet/NotSufficientModal'), {
ssr: false
});
const SystemMsgModal = dynamic(() => import('@/components/support/user/inform/SystemMsgModal'), {
ssr: false
});
const ImportantInform = dynamic(() => import('@/components/support/user/inform/ImportantInform'), {
ssr: false
});
const UpdateContact = dynamic(() => import('@/components/support/user/inform/UpdateContactModal'), {
ssr: false
});
const ManualCopyModal = dynamic(
() => import('@fastgpt/web/hooks/useCopyData').then((mod) => mod.ManualCopyModal),
{ ssr: false }
);
const pcUnShowLayoutRoute: Record<string, boolean> = {
@@ -56,8 +70,7 @@ const Layout = ({ children }: { children: JSX.Element }) => {
const { toast } = useToast();
const { t } = useTranslation();
const { Loading } = useLoading();
const { loading, feConfigs, notSufficientModalType, llmModelList, embeddingModelList } =
useSystemStore();
const { loading, feConfigs, llmModelList, embeddingModelList } = useSystemStore();
const { isPc } = useSystem();
const { userInfo, isUpdateNotification, setIsUpdateNotification } = useUserStore();
const { setUserDefaultLng } = useI18nLng();
@@ -66,6 +79,7 @@ const Layout = ({ children }: { children: JSX.Element }) => {
() => router.pathname === '/chat' && Object.values(router.query).join('').length !== 0,
[router.pathname, router.query]
);
const isHideNavbar = !!pcUnShowLayoutRoute[router.pathname];
// System hook
const { data, refetch: refetchUnRead } = useQuery(['getUnreadCount'], getUnreadCount, {
@@ -75,8 +89,6 @@ const Layout = ({ children }: { children: JSX.Element }) => {
const unread = data?.unReadCount || 0;
const importantInforms = data?.importantInforms || [];
const isHideNavbar = !!pcUnShowLayoutRoute[router.pathname];
const showUpdateNotification =
isUpdateNotification &&
feConfigs?.bind_notification_method &&
@@ -153,14 +165,15 @@ const Layout = ({ children }: { children: JSX.Element }) => {
</Box>
{feConfigs?.isPlus && (
<>
{notSufficientModalType && <NotSufficientModal type={notSufficientModalType} />}
{!!userInfo && <SystemMsgModal />}
<NotSufficientModal />
<SystemMsgModal />
{showUpdateNotification && (
<UpdateContact onClose={() => setIsUpdateNotification(false)} mode="contact" />
)}
{!!userInfo && importantInforms.length > 0 && (
<ImportantInform informs={importantInforms} refetch={refetchUnRead} />
)}
<ResetExpiredPswModal />
<WorkorderButton />
</>
)}