feat:only use email and password register person can change password
This commit is contained in:
1 parent
babb007082
commit
deb0161a3a
3 files changed
+24
-10
No files matched your search
@@ -16,6 +16,9 @@ import { Avatar, Card, CardBody, Button, Divider } from "@nextui-org/react";
|
||||
import { RechargeModal } from "@/shared/components/modal/RechargeModal";
|
||||
import { useTranslation } from "@/shared/lib/useTranslation";
|
||||
import { ChangePasswordModal } from "@/components/common/ChangePasswordModal";
|
||||
import { usePlatformConfig } from "@/shared/contexts/PlatformConfigContext";
|
||||
import { RegisterType } from "@/shared/store/User";
|
||||
import { EmailMode } from "@/shared/types/system";
|
||||
|
||||
const DashboardContent: React.FC = () => {
|
||||
const { t } = useTranslation();
|
||||
@@ -26,6 +29,7 @@ const DashboardContent: React.FC = () => {
|
||||
state.user_token,
|
||||
state.user,
|
||||
]);
|
||||
const { loginConfig } = usePlatformConfig();
|
||||
|
||||
const [logOut, useGetUser] = useGlobalStore((state) => [
|
||||
state.logOut,
|
||||
@@ -113,15 +117,19 @@ const DashboardContent: React.FC = () => {
|
||||
onLogout={handleLogout}
|
||||
sidebarItems={sidebarItems}
|
||||
bottomPanel={
|
||||
<Button
|
||||
variant="light"
|
||||
color="default"
|
||||
startContent={<Key className="w-4 h-4" />}
|
||||
className="w-full justify-start mb-2"
|
||||
onPress={handleChangePassword}
|
||||
>
|
||||
{t("Change Password")}
|
||||
</Button>
|
||||
loginConfig?.email?.is_enabled &&
|
||||
loginConfig?.email?.mode === EmailMode.PASSWORD &&
|
||||
user?.register_type === RegisterType.EMAIL && (
|
||||
<Button
|
||||
variant="light"
|
||||
color="default"
|
||||
startContent={<Key className="w-4 h-4" />}
|
||||
className="w-full justify-start mb-2"
|
||||
onPress={handleChangePassword}
|
||||
>
|
||||
{t("Change Password")}
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
userProfilePanel={
|
||||
user && (
|
||||
|
||||
@@ -95,7 +95,7 @@ export const PlatformConfigForm: React.FC<PlatformConfigFormProps> = ({
|
||||
{t("Platform Information")}
|
||||
</h3>
|
||||
<p className="text-sm text-gray-500">
|
||||
{t("Configure platform logo, name, titles, and language")}
|
||||
{t("Configure platform logo, name, titles, language")}
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -4,6 +4,11 @@ interface APIKey {
|
||||
create_time: number;
|
||||
apikey_id: string;
|
||||
}
|
||||
export enum RegisterType {
|
||||
EMAIL = "email",
|
||||
GOOGLE = "google",
|
||||
INNER = "inner",
|
||||
}
|
||||
export interface User {
|
||||
user_id: string;
|
||||
user_email: string;
|
||||
@@ -26,4 +31,5 @@ export interface User {
|
||||
wallet?: {
|
||||
balance: number;
|
||||
};
|
||||
register_type: RegisterType;
|
||||
}
|
||||
Reference in new issue
Block a user