This commit is contained in:
parent
ecbb83315f
commit
c8ea591f7a
|
|
@ -17,6 +17,7 @@ export default function AuthenticationPage() {
|
||||||
const [email, setEmail] = React.useState("");
|
const [email, setEmail] = React.useState("");
|
||||||
const [password, setPassword] = React.useState("");
|
const [password, setPassword] = React.useState("");
|
||||||
const [code, setCode] = React.useState("");
|
const [code, setCode] = React.useState("");
|
||||||
|
const [referrer, setReferrer] = React.useState("");
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
|
@ -37,10 +38,11 @@ export default function AuthenticationPage() {
|
||||||
setVerification={setVerify}
|
setVerification={setVerify}
|
||||||
|
|
||||||
email={setEmail}
|
email={setEmail}
|
||||||
|
referrer={setReferrer}
|
||||||
password={setPassword}
|
password={setPassword}
|
||||||
emailValue={email}
|
emailValue={email}
|
||||||
passwordValue={password}
|
passwordValue={password}
|
||||||
|
referrerValue={referrer}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,10 @@ export function MixSignUp(props: {
|
||||||
|
|
||||||
email: (value: string) => void;
|
email: (value: string) => void;
|
||||||
password: (value: string) => void;
|
password: (value: string) => void;
|
||||||
|
referrer: (value: string) => void;
|
||||||
emailValue: string;
|
emailValue: string;
|
||||||
passwordValue: string;
|
passwordValue: string;
|
||||||
|
referrerValue: string;
|
||||||
}) {
|
}) {
|
||||||
|
|
||||||
const [isLoading, setIsLoading] = React.useState(false);
|
const [isLoading, setIsLoading] = React.useState(false);
|
||||||
|
|
@ -88,9 +90,9 @@ export function MixSignUp(props: {
|
||||||
setTransferLoading(false);
|
setTransferLoading(false);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const signUpWithOutCode = async (username: string, password: string) => {
|
const signUpWithOutCode = async (username: string, password: string, referrer: string) => {
|
||||||
|
|
||||||
console.log("--username:", username, "--password:", password);
|
console.log("--username:", username, "--password:", password, "--referrer", referrer);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isLoading ||
|
isLoading ||
|
||||||
|
|
@ -102,7 +104,7 @@ export function MixSignUp(props: {
|
||||||
|
|
||||||
await service.post('/api/v1/customer/uregister', {
|
await service.post('/api/v1/customer/uregister', {
|
||||||
user_name: username,
|
user_name: username,
|
||||||
Referral: "Referral",
|
Referral: referrer,
|
||||||
password: md5(password),
|
password: md5(password),
|
||||||
}).then(function (result: any) {
|
}).then(function (result: any) {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
|
|
@ -137,6 +139,7 @@ export function MixSignUp(props: {
|
||||||
<form className="grid gap-2" onSubmit={(e) => {
|
<form className="grid gap-2" onSubmit={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const regname = new FormData(e.currentTarget).get("regname");
|
const regname = new FormData(e.currentTarget).get("regname");
|
||||||
|
const refer = new FormData(e.currentTarget).get("referreredit")
|
||||||
|
|
||||||
if (
|
if (
|
||||||
typeof regname !== "string"
|
typeof regname !== "string"
|
||||||
|
|
@ -144,8 +147,9 @@ export function MixSignUp(props: {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("--regname:", regname)
|
console.log("--regname:", regname, "--referrer:", refer)
|
||||||
props.email(regname)
|
props.email(regname)
|
||||||
|
props.referrer(refer)
|
||||||
|
|
||||||
setGoPassword(true)
|
setGoPassword(true)
|
||||||
}}>
|
}}>
|
||||||
|
|
@ -168,13 +172,13 @@ export function MixSignUp(props: {
|
||||||
className="h-10 text-black duration-500 bg-transparent focus:text-black border-black/20 focus:bg-white focus:border-black rounded hover:bg-white/20 hover:border-black/40 placeholder:black/20 "
|
className="h-10 text-black duration-500 bg-transparent focus:text-black border-black/20 focus:bg-white focus:border-black rounded hover:bg-white/20 hover:border-black/40 placeholder:black/20 "
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<label htmlFor="referralcode" className="text-xs text-black/50">
|
<label htmlFor="referreredit" className="text-xs text-black/50">
|
||||||
{t("refcode")}
|
{t("refcode")}
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<Input
|
<Input
|
||||||
name="referralcode"
|
name="referreredit"
|
||||||
placeholder={t("auth.refcodeplaceholder")}
|
placeholder={t("auth.referrerplaceholder")}
|
||||||
type="text"
|
type="text"
|
||||||
defaultValue={props.emailValue}
|
defaultValue={props.emailValue}
|
||||||
autoCapitalize="none"
|
autoCapitalize="none"
|
||||||
|
|
@ -205,7 +209,7 @@ export function MixSignUp(props: {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
await signUpWithOutCode(props.emailValue, password)
|
await signUpWithOutCode(props.emailValue, password, props.referrer)
|
||||||
|
|
||||||
setGoPassword(false)
|
setGoPassword(false)
|
||||||
}} >
|
}} >
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
"verification_code": "Six-digit verification code",
|
"verification_code": "Six-digit verification code",
|
||||||
"send_again": "Send Again",
|
"send_again": "Send Again",
|
||||||
"email_address": "Email Address",
|
"email_address": "Email Address",
|
||||||
"refcodeplaceholder": "Enter your referral code(Optional)",
|
"referrerplaceholder": "Enter your referral code(Optional)",
|
||||||
"mixplacehoder": "Enter your phone number or Email address",
|
"mixplacehoder": "Enter your phone number or Email address",
|
||||||
"creat_account": "Creat Account",
|
"creat_account": "Creat Account",
|
||||||
"frogot_password": "Frogot password?",
|
"frogot_password": "Frogot password?",
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
"send_again": "再次发送",
|
"send_again": "再次发送",
|
||||||
"email_address": "电子邮件地址",
|
"email_address": "电子邮件地址",
|
||||||
"mixplacehoder": "输入你的手机号或者邮箱地址",
|
"mixplacehoder": "输入你的手机号或者邮箱地址",
|
||||||
"refcodeplaceholder": "填写你的推荐码(选填)",
|
"referrerplaceholder": "填写你的推荐码(选填)",
|
||||||
"creat_account": "创建帐户",
|
"creat_account": "创建帐户",
|
||||||
"frogot_password": "忘记密码?",
|
"frogot_password": "忘记密码?",
|
||||||
"account_not_found": "未找到帐户,您想注册吗?",
|
"account_not_found": "未找到帐户,您想注册吗?",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue