diff --git a/app/app/(auth)/layout.tsx b/app/app/(auth)/layout.tsx
index 60f219ccb..905e71975 100644
--- a/app/app/(auth)/layout.tsx
+++ b/app/app/(auth)/layout.tsx
@@ -1,6 +1,7 @@
import "@/app/app/login.scss";
import { Metadata } from "next";
import { ReactNode } from "react";
+import Image from "next/image";
// import { VerifiedUser } from "@/lib/auth";
// import { redirect } from "next/navigation";
@@ -22,7 +23,19 @@ export default async function AuthLayout({
return (
-
-
- Sign in to your account
-
-
+ <>
+ {/*
*/}
-
- }
- >
-
-
+ {/**/}
+ {/* }*/}
+ {/*>*/}
+ {/* */}
+ {/**/}
+
-
-
-
- }
- >
-
-
+
+ {/**/}
+ {/* }*/}
+ {/*>*/}
+ {/* */}
+ {/**/}
+
+ {" "}
+ 其它登录方式{" "}
+
+
-
+ >
);
}
diff --git a/app/app/(auth)/login/set-password/page.tsx b/app/app/(auth)/login/set-password/page.tsx
new file mode 100644
index 000000000..f0fe2ff14
--- /dev/null
+++ b/app/app/(auth)/login/set-password/page.tsx
@@ -0,0 +1,35 @@
+"use client";
+import { redirect } from "next/navigation";
+// import { getSession } from "@/lib/auth";
+import { useSession } from "next-auth/react";
+import { Button, Checkbox, Form, Input } from "antd";
+
+type LoginType = "phone" | "account";
+
+export default function SetPasswordPage() {
+ const { data: session, status } = useSession();
+ // if (typeof window !== "undefined" && loading) return null;
+ console.log("2222222", session);
+ // @ts-expect-error
+ if (!session?.user?.hasPassword) {
+ }
+ // else {
+ // redirect("/")
+ // }
+ return (
+ <>
+
Signed in as {}
+
需要设置一个密码
+
+
+
+ >
+ );
+}
diff --git a/app/app/(auth)/login/user-login-button.tsx b/app/app/(auth)/login/user-login-button.tsx
deleted file mode 100644
index 20f047575..000000000
--- a/app/app/(auth)/login/user-login-button.tsx
+++ /dev/null
@@ -1,370 +0,0 @@
-"use client";
-
-import { signIn } from "next-auth/react";
-import React, { useState, useEffect, useRef, use } from "react";
-import { isName } from "@/lib/auth_list";
-import {
- Form,
- Input,
- InputRef,
- notification as notificationModule,
- NotificationArgsProps,
-} from "antd";
-import { UserOutlined, MailOutlined } from "@ant-design/icons";
-import type { FormProps } from "antd";
-import { SignInOptions } from "next-auth/react";
-
-export default function UserLoginButton() {
- const [loading, setLoading] = useState(false);
- const [loginForm] = Form.useForm();
- const nameInput = useRef
(null);
- // const passwordInput = useRef(null);
- // const emailInput = useRef(null);
- const [username, setUsername] = useState("");
- // const [password, setPassword] = useState("");
- const [notification, notificationContextHolder] =
- notificationModule.useNotification();
-
- const openNotification = (level: string, arms: NotificationArgsProps) => {
- if (level === "error") {
- notification.error({
- ...arms,
- placement: "topRight",
- });
- } else {
- notification.info({
- ...arms,
- placement: "topRight",
- });
- }
- };
-
- // const [error, setError] = useState(false);
- type FieldType = {
- username?: string;
- password?: string;
- email?: string;
- };
- const onFinish: FormProps["onFinish"] = (values) => {
- setLoading(true);
- let signInOptions: SignInOptions = {
- redirect: false,
- };
- let loginProvider = "";
-
- if (values.email) {
- loginProvider = "email";
- signInOptions = { ...signInOptions, email: values.email };
- } else {
- loginProvider = "credentials";
- signInOptions = {
- ...signInOptions,
- username: values.username,
- password: values.password ?? "",
- };
- }
- signIn(loginProvider, signInOptions).then((result) => {
- setLoading(false);
- if (!result?.error) {
- window.location.href =
- result?.url && result.url.includes("verify") ? result.url : "/";
- } else {
- switch (result.error) {
- case "AccessDenied":
- openNotification("error", {
- message: "登录失败",
- description: (
-
- 无权限,请确认用户名正确并等待审批
-
- 或联系管理员
-
- ),
- });
- break;
- default:
- break;
- }
-
- if (loginProvider === "credentials") {
- loginForm.setFields([
- {
- name: "username",
- errors: [result.error],
- },
- {
- name: "password",
- errors: [result.error],
- },
- ]);
- }
- if (loginProvider === "email") {
- loginForm.setFields([
- {
- name: "email",
- errors: [result.error],
- },
- ]);
- }
- }
- console.log("response,", result);
- });
-
- setLoading(false);
- console.log("Success:", values);
- };
-
- const onFinishFailed: FormProps["onFinishFailed"] = (
- errorInfo,
- ) => {
- console.log("Failed:", errorInfo);
- };
-
- // const handleNameComposition = (
- // e: React.CompositionEvent,
- // ) => {
- // if (e.type === "compositionend") {
- // setUsername(e.currentTarget.value);
- // }
- // };
- // const onNameChange = (e: React.ChangeEvent) => {
- // if ((e.nativeEvent as InputEvent).isComposing) {
- // return;
- // }
- // setUsername(e.target.value);
- // };
- // const onPasswordChange = (e: React.ChangeEvent) => {
- // if ((e.nativeEvent as InputEvent).isComposing) {
- // return;
- // }
- // setPassword(e.target.value);
- // };
- // const onSubmitHandler = async (e: React.FormEvent) => {
- // // handle yow submition
- // setLoading(true);
- // e.preventDefault();
- //
- // let result: { error: any; url: string | null } | undefined = {
- // error: null,
- // url: null,
- // };
- // if (emailInput.current && emailInput.current.value) {
- // result = await signIn("email", {
- // email: emailInput.current.value,
- // redirect: false,
- // });
- // } else {
- // result = await signIn("credentials", {
- // username: username,
- // password: password,
- // redirect: false,
- // });
- // }
- // console.log("0000000000000", result);
- // setLoading(false);
- // if (!result?.error) {
- // window.location.href =
- // result?.url && result.url.includes("verify") ? result.url : "/";
- // } else setError(true);
- // };
-
- // useEffect(() => {
- // if (!username) return;
- // if (nameInput.current) {
- // if (!isName(username)) {
- // setError(true);
- // } else {
- // setError(false);
- // }
- // }
- // }, [username]);
-
- return (
- <>
- {notificationContextHolder}
-
-
-
-
-
-
- {/* */}
- >
- );
-}
diff --git a/app/app/(auth)/login/user-login-core.tsx b/app/app/(auth)/login/user-login-core.tsx
new file mode 100644
index 000000000..beff8d709
--- /dev/null
+++ b/app/app/(auth)/login/user-login-core.tsx
@@ -0,0 +1,292 @@
+"use client";
+
+import { signIn } from "next-auth/react";
+import React, { useState, useEffect, useRef, use } from "react";
+import { isName } from "@/lib/auth_list";
+import {
+ Form,
+ Tabs,
+ Input,
+ InputRef,
+ notification as notificationModule,
+ NotificationArgsProps,
+} from "antd";
+import { UserOutlined, MailOutlined } from "@ant-design/icons";
+import type { FormProps, TabsProps } from "antd";
+import { SignInOptions } from "next-auth/react";
+
+export default function UserLoginCore() {
+ const [loading, setLoading] = useState(false);
+ const [loginForm] = Form.useForm();
+ const [loginMethod, setLoginMethod] = useState<"common" | "cap">("common");
+ const [notification, notificationContextHolder] =
+ notificationModule.useNotification();
+
+ const openNotification = (level: string, arms: NotificationArgsProps) => {
+ if (level === "error") {
+ notification.error({
+ ...arms,
+ placement: "topRight",
+ });
+ } else {
+ notification.info({
+ ...arms,
+ placement: "topRight",
+ });
+ }
+ };
+
+ // const [error, setError] = useState(false);
+ type FieldType = {
+ username?: string;
+ password?: string;
+ email?: string;
+ };
+ const onFinish: FormProps