diff --git a/messages/en.json b/messages/en.json index ea81b85..a7296f7 100644 --- a/messages/en.json +++ b/messages/en.json @@ -14,16 +14,18 @@ "ResetPass": "Reset your password", "Username": "Username", "Password": "Password", + "Tel": "Telephone", "Captcha": "Captcha", "CaptchaError": "Captcha Error", "Email": "Email", "ConfirmPass": "ConfirmPassword", + "ReAccount": "Retrieve account", "Confirm": "Confirm", "Submit": "Submit", "H2": "About GitDataAi Cloud", "Description": "GitDataAi Cloud is a platform for data management, visualization, and analysis that helps you manage and explore data resources efficiently.", "Connectivity": "GitData.AI is a one-stop collaborative platform for the development, management, and trading of data products (such as AI models)to help you efficiently develop and explore data products.", - "Protection": "This site is protected by Cloudflare and subject to the Google", + "Protection": "This site is protected by Cloudflare and subject to the GitData.AI", "PrivacyPolicy": "Privacy Policy", "And": "and", "Service": "Terms of Service.", @@ -44,7 +46,8 @@ "Send": "Send", "SendSuccess": " successfully", "SendFail": " failed:", - "Search": "Search" + "Search": "Search", + "FindAccount": "Find Account" }, "Header": { "Home": "Home", diff --git a/messages/zh-CN.json b/messages/zh-CN.json index fa7097b..019ca65 100644 --- a/messages/zh-CN.json +++ b/messages/zh-CN.json @@ -14,16 +14,18 @@ "ResetPass": "重置密码", "Username": "用户名", "Password": "密码", + "Tel": "手机号", "Captcha": "验证码", "CaptchaError": "验证码错误", "Email": "邮箱", "ConfirmPass": "确认密码", + "ReAccount": "找回账号", "Confirm": "确认", "Submit": "提交", "H2": "关于 GitDataAi Cloud", "Description": "GitDataAi Cloud 是一个用于数据管理、可视化和分析的平台,帮助您高效地管理和探索数据资源。", "Connectivity": "GitData.AI 是一个用于数据产品(例如AI模型)的开发、管理、交易的一站式协作平台,帮助您高效地开发和探索数据产品。", - "Protection": "此站点受 Cloudflare 的保护,且遵循 Google", + "Protection": "此站点受 Cloudflare 的保护,且遵循 GitData.AI", "PrivacyPolicy": "隐私政策", "And": "和", "Service": "服务条款。", @@ -44,7 +46,8 @@ "Send": "发送", "Success": "成功", "Fail": "失败:", - "Search": "搜索" + "Search": "搜索", + "FindAccount": "查找账户" }, "Header": { "Home": "主页", diff --git a/package.json b/package.json index 1d0f0e9..646bb8d 100644 --- a/package.json +++ b/package.json @@ -10,13 +10,14 @@ "preview": "vite preview" }, "dependencies": { - "@vitejs/plugin-basic-ssl": "^1.1.0", "@types/js-cookie": "^3.0.6", + "@vitejs/plugin-basic-ssl": "^1.1.0", "axios": "^1.7.7", "i18next": "^23.16.5", "i18next-browser-languagedetector": "^8.0.0", "js-cookie": "^3.0.5", "less": "^4.2.0", + "jzfs-ts-api": "./jzfs-api", "localforage": "^1.10.0", "primeicons": "^7.0.0", "react": "^18.3.1", @@ -36,6 +37,7 @@ "eslint-plugin-react-hooks": "^5.0.0", "eslint-plugin-react-refresh": "^0.4.14", "globals": "^15.11.0", + "jzfs-ts-api": "github:lazhenyi/jzfs-api", "postcss": "^8.4.47", "primereact": "^10.8.4", "react-router-dom": "^6.28.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e6b9f80..3896ed7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -26,6 +26,9 @@ importers: js-cookie: specifier: ^3.0.5 version: 3.0.5 + jzfs-ts-api: + specifier: ./jzfs-api + version: link:jzfs-api less: specifier: ^4.2.0 version: 4.2.0 diff --git a/src/app/auth/FindAccount.tsx b/src/app/auth/FindAccount.tsx index dda1299..a9a1858 100644 --- a/src/app/auth/FindAccount.tsx +++ b/src/app/auth/FindAccount.tsx @@ -7,10 +7,6 @@ import {Toast} from "primereact/toast"; const FindAccount = () => { const [t] = useTranslation("Auth") - const [Step,setStep] = useState(0) - const [CountDown,setCountDown] = useState(60) - const [isCountDown,setisCountDown] = useState(false) - const [Oauth,setOauth] = useState[]>([]); const [user,Setuser] = useState({ email:"", password:"", @@ -21,82 +17,25 @@ const FindAccount = () => { const [Time,setTime] = useState(t("Get")+t("Captcha")) const nav = useNavigate(); const toast = useRef(null) - useEffect(()=>{ - setOauth([ - // , - // , - // , - ]) - },[]) - const handleSend = () => { - if(!isCountDown ){ - Auth_api.send(user.email) - .then(res=>{ - if (res.data.code === 200){ - toast.current?.show({severity:'success',summary:t("Success"),detail:t("Send")+t('Success')}) - // alert(t("Send")+t("Success")) - setisCountDown(true) - }else { - toast.current?.show({severity:'error',summary:t("Fail"),detail:t("Send")+t("Fail")}) - // alert(t("Send")+t("Fail")+res.data.msg) - } - }) - } - } - const validate = (code:string) => { - Auth_api.verification(code) - .then(res=>{ - if (res.data.code === 200){ - setStep(2) - }else { - toast.current?.show({severity:'error',summary:t("Fail"),detail:t("CaptchaError")}) - // alert(t("CaptchaError")) - } - }) - } - const InputCode = (code: string) => { - Setuser({...user,code:code}) - if (code.length === 6){ - validate(code); - } - } const handleNext = () => { - Auth_api.register({ - email:user.email, - password:user.password, - username:user.username - }) - .then(res=>{ - if (res.data.code === 200){ - nav("/auth/login") - }else { - toast.current?.show({severity:'error',summary:t("RegistrationFailed"),detail:res.data.msg}) - // alert(t("RegistrationFailed")+res.data.msg) - } - }) + // Auth_api.register({ + // email:user.email, + // password:user.password, + // username:user.username + // }) + // .then(res=>{ + // if (res.data.code === 200){ + // nav("/auth/login") + // }else { + // toast.current?.show({severity:'error',summary:t("RegistrationFailed"),detail:res.data.msg}) + // // alert(t("RegistrationFailed")+res.data.msg) + // } + // }) } const handleEmailNext = (e:string) => { Setuser({...user,email:e}) - if (Step === 0){ - setStep(1) - } } - useEffect(() => { - if (isCountDown){ - const timer = setTimeout(() => { - setCountDown(CountDown - 1) - if(CountDown == 0){ - setisCountDown(false) - } - }, 1000) - return () =>{ - clearTimeout(timer) - } - - } - setCountDown(60) - }, [isCountDown,CountDown]); const login = () => { nav("/auth/login") } @@ -106,33 +45,42 @@ const FindAccount = () => {
- JZFS + JZFS {/*GitDataAI*/}
-

找回账号

+

{t("ReAccount")}

- { + { handleEmailNext(x.target.value) - }} type="text" placeholder={t("Enter")+t("Email")} className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2"/> + }} type="text" placeholder={t("Enter") + t("Email")} + className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2"/> - {Setuser({...user,password:x.target.value})}} type="password" placeholder={"请输入你关联的手机号"} className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2 showDiv"/> - {Setuser({...user,username:x.target.value})}} type="text" placeholder={t("Enter")+t("Username")} className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2 showDiv"/> + { + Setuser({...user, password: x.target.value}) + }} type="password" placeholder={t("Enter") + t("Tel")} + className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2"/> + { + Setuser({...user, username: x.target.value}) + }} type="text" placeholder={t("Enter") + t("Username")} + className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2"/> - +
- + {t("RemAccount")}

- JZFS + JZFS {/*GitDataAI*/}

{t("Connectivity")}

-

{t("Protection")}{t("PrivacyPolicy")}{t("And")}{t("Service")}

+

{t("Protection")} {t("PrivacyPolicy")}{t("And")}{t("Service")}

); diff --git a/src/app/auth/Forgot.tsx b/src/app/auth/Forgot.tsx index 9bf48a4..fcd2c27 100644 --- a/src/app/auth/Forgot.tsx +++ b/src/app/auth/Forgot.tsx @@ -101,7 +101,6 @@ const Forgot =()=>{
JZFS - {/*GitDataAI*/}

{t("ResetPass")}

@@ -118,10 +117,9 @@ const Forgot =()=>{
JZFS - {/*GitDataAI*/}

{t("Connectivity")}

-

{t("Protection")}{t("PrivacyPolicy")}{t("And")}{t("Service")}

+

{t("Protection")} {t("PrivacyPolicy")}{t("And")}{t("Service")}

); diff --git a/src/app/auth/Login.tsx b/src/app/auth/Login.tsx index eee8678..a25eebc 100644 --- a/src/app/auth/Login.tsx +++ b/src/app/auth/Login.tsx @@ -85,10 +85,9 @@ const Login = () => {
JZFS - {/*GitDataAI*/}

{t("Connectivity")}

-

{t("Protection")}{t("PrivacyPolicy")}{t("And")}{t("Service")}

+

{t("Protection")} {t("PrivacyPolicy")}{t("And")}{t("Service")}

); diff --git a/src/app/auth/Register.tsx b/src/app/auth/Register.tsx index efc612f..36e76f8 100644 --- a/src/app/auth/Register.tsx +++ b/src/app/auth/Register.tsx @@ -4,6 +4,7 @@ import {Auth_api} from "@/store/useUsers.tsx"; import Login from "@/app/auth/Login.tsx"; import {useTranslation} from "react-i18next"; import {Toast} from "primereact/toast"; +// import {UserApi} from "jzfs-ts-api/dist"; const Register = () => { const [t] = useTranslation("Auth") @@ -21,6 +22,7 @@ const Register = () => { const [Time,setTime] = useState(t("Get")+t("Captcha")) const nav = useNavigate(); const toast = useRef(null) + // const n = new UserApi(); useEffect(()=>{ setOauth([ // , @@ -34,11 +36,9 @@ const Register = () => { .then(res=>{ if (res.data.code === 200){ toast.current?.show({severity:'success',summary:t("Success"),detail:t("Send")+t('Success')}) - // alert(t("Send")+t("Success")) setisCountDown(true) }else { toast.current?.show({severity:'error',summary:t("Fail"),detail:t("Send")+t("Fail")}) - // alert(t("Send")+t("Fail")+res.data.msg) } }) } @@ -51,7 +51,6 @@ const Register = () => { setStep(2) }else { toast.current?.show({severity:'error',summary:t("Fail"),detail:t("CaptchaError")}) - // alert(t("CaptchaError")) } }) } @@ -62,19 +61,22 @@ const Register = () => { } } const handleNext = () => { - Auth_api.register({ - email:user.email, - password:user.password, - username:user.username - }) - .then(res=>{ - if (res.data.code === 200){ - nav("/auth/login") - }else { - toast.current?.show({severity:'error',summary:t("RegistrationFailed"),detail:res.data.msg}) - // alert(t("RegistrationFailed")+res.data.msg) - } + if(user.password ===user.passwordE){ + Auth_api.register({ + email:user.email, + password:user.password, + username:user.username }) + .then(res=>{ + if (res.data.code === 200){ + nav("/auth/login") + }else { + toast.current?.show({severity:'error',summary:t("RegistrationFailed"),detail:res.data.msg}) + } + }) + }else{ + toast.current?.show({severity:'error',summary:t("Failed"),detail:t("InvalidConfirmPass")}) + } } const handleEmailNext = (e:string) => { Setuser({...user,email:e}) @@ -104,61 +106,78 @@ const Register = () => { <> -
-
- JZFS - {/*GitDataAI*/} -
-

{t("RegisterContinue")}

-
-
- { - handleEmailNext(x.target.value) - }} type="text" placeholder={t("Enter")+t("Email")} className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2"/> - { - (Step===1 || Step === 2)?( -
- InputCode(e.target.value)} type="text" placeholder={t("Enter")+t("Captcha")} className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2"/> - -
- ):null - } - { - Step===2?( - <> - {Setuser({...user,password:x.target.value})}} type="password" placeholder={t("Enter")+t("Password")} className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2 showDiv"/> - {Setuser({...user,passwordE:x.target.value})}} type="password" placeholder={t("ConfirmP")} className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2 showDiv"/> - {Setuser({...user,username:x.target.value})}} type="text" placeholder={t("Enter")+t("Username")} className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2 showDiv"/> - - ):null - } +
+
+ JZFS + {/*GitDataAI*/} +
+

{t("RegisterContinue")}

+
+ + { + handleEmailNext(x.target.value) + }} type="text" placeholder={t("Enter") + t("Email")} + className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2"/> + { + (Step === 1 || Step === 2) ? ( +
+ InputCode(e.target.value)} type="text" + placeholder={t("Enter") + t("Captcha")} + className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2"/> + +
+ ) : null + } + { + Step === 2 ? ( + <> + { + Setuser({...user, password: x.target.value}) + }} type="password" placeholder={t("Enter") + t("Password")} + className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2 showDiv"/> + { + Setuser({...user, passwordE: x.target.value}) + }} type="password" placeholder={t("ConfirmP")} + className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2 showDiv"/> + { + Setuser({...user, username: x.target.value}) + }} type="text" placeholder={t("Enter") + t("Username")} + className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2 showDiv"/> + + ) : null + } - + -

{t("OrContinue")}

- { - Oauth.map((item)=>{ - return item - }) - } - -
+

{t("OrContinue")}

+ { + Oauth.map((item) => { + return item + }) + } + +

- JZFS + JZFS {/*GitDataAI*/}

{t("Connectivity")}

-

{t("Protection")}{t("PrivacyPolicy")}{t("And")}{t("Service")}

+

{t("Protection")} {t("PrivacyPolicy")}{t("And")}{t("Service")}

); diff --git a/src/app/auth/SearchAccount.tsx b/src/app/auth/SearchAccount.tsx index a87da98..70bcb64 100644 --- a/src/app/auth/SearchAccount.tsx +++ b/src/app/auth/SearchAccount.tsx @@ -4,7 +4,7 @@ import {Auth_api} from "@/store/useUsers.tsx"; import Login from "@/app/auth/Login.tsx"; import {useTranslation} from "react-i18next"; import {Toast} from "primereact/toast"; -import Forgot from "@/app/auth/Forgot.tsx"; +import login from "@/app/auth/Login.tsx"; const SearchAccount = () => { const [t] = useTranslation("Auth") @@ -25,7 +25,7 @@ const SearchAccount = () => { // nav(`/auth/Forgot?email=${res.data.email}`) // } else { // // 邮箱不存在,导航到另一个页面 - // nav("/auth/no-email"); + // nav("/auth/FindAccount"); // } } catch (error) { toast.current?.show({ severity: 'error', summary: t("Error"), detail: t("SomethingWrong") }); @@ -34,35 +34,39 @@ const SearchAccount = () => { }; - const Forgot = () => { - nav("/auth/FindAccount") + const login = () => { + nav("/auth/login") } return ( <>
- JZFS + JZFS {/*GitDataAI*/}
-

{t("ResetPass")}

+

{t("FindAccount")}

- Setuser((user)=>({...user,email:e.target.value}))} value={user.email} type="email" placeholder={t("Enter")+t("Email")} className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2 showDiv"/> + Setuser((user) => ({...user, email: e.target.value}))} + value={user.email} type="email" placeholder={t("Enter") + t("Email")} + className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2"/> - +

- JZFS + JZFS

{t("Connectivity")}

-

{t("Protection")}{t("PrivacyPolicy")}{t("And")}{t("Service")}

+

{t("Protection")} {t("PrivacyPolicy")}{t("And")}{t("Service")}

); diff --git a/src/app/auth/UpPwd.tsx b/src/app/auth/UpPwd.tsx index 0a4452f..3115c19 100644 --- a/src/app/auth/UpPwd.tsx +++ b/src/app/auth/UpPwd.tsx @@ -7,7 +7,6 @@ import {Toast} from "primereact/toast"; const UpPwd = () => { const [t] = useTranslation("Auth") - const [Oauth,setOauth] = useState[]>([]); const [user,Setuser] = useState({ email:"", password:"", @@ -20,18 +19,22 @@ const UpPwd = () => { const { token } = useParams<{ token: string }>(); const handleNext = () => { - Auth_api.updatePassword({ - token:token, - password: user.password - }) - .then(res=>{ - if (res.data.code === 200){ - nav("/auth/login") - }else { - toast.current?.show({severity:'error',summary:t("Failed"),detail:res.data.msg}) - // alert(t("RegistrationFailed")+res.data.msg) - } + if(user.password ===user.passwordE){ + Auth_api.updatePassword({ + token:token, + password: user.password }) + .then(res=>{ + if (res.data.code === 200){ + nav("/auth/login") + }else { + toast.current?.show({severity:'error',summary:t("Failed"),detail:res.data.msg}) + // alert(t("RegistrationFailed")+res.data.msg) + } + }) + }else{ + toast.current?.show({severity:'error',summary:t("Failed"),detail:t("InvalidConfirmPass")}) + } } const login = () => { nav("/auth/login") @@ -41,16 +44,24 @@ const UpPwd = () => {
- JZFS + JZFS {/*GitDataAI*/}

{t("ResetPass")}

- {Setuser({...user,password:x.target.value})}} type="password" placeholder={t("Enter")+t("Password")} className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2 showDiv"/> - {Setuser({...user,passwordE:x.target.value})}} type="password" placeholder={t("ConfirmP")} className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2 showDiv"/> + { + Setuser({...user, password: x.target.value}) + }} type="password" placeholder={t("Enter") + t("Password")} + className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2"/> + { + Setuser({...user, passwordE: x.target.value}) + }} type="password" placeholder={t("ConfirmP")} + className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2"/> - +
@@ -59,10 +70,10 @@ const UpPwd = () => {

- JZFS + JZFS

{t("Connectivity")}

-

{t("Protection")}{t("PrivacyPolicy")}{t("And")}{t("Service")}

+

{t("Protection")} {t("PrivacyPolicy")}{t("And")}{t("Service")}

);