Spaces:
Running
Running
muxi feng
commited on
Commit
·
1e59d48
1
Parent(s):
e5d46ab
修复注册问题
Browse files- app/api/user/register/route.ts +19 -28
- app/components/register.module.scss +5 -0
- app/components/register.tsx +3 -2
- app/store/user.ts +1 -5
app/api/user/register/route.ts
CHANGED
@@ -2,35 +2,26 @@ import { NextRequest } from "next/server";
|
|
2 |
|
3 |
export async function POST(req: NextRequest) {
|
4 |
try {
|
5 |
-
const admin
|
6 |
-
const
|
7 |
-
const user
|
8 |
-
const password
|
9 |
-
const name
|
10 |
-
const
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
"
|
20 |
-
password +
|
21 |
-
"&name=" +
|
22 |
-
name +
|
23 |
-
"&mail=" +
|
24 |
-
mail +
|
25 |
-
"&code=" +
|
26 |
-
code,
|
27 |
-
{
|
28 |
-
method: "GET",
|
29 |
},
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
return new Response(JSON.stringify(msg))
|
34 |
} catch (e) {
|
35 |
console.error("[shuixian] ", e);
|
36 |
return new Response(JSON.stringify(e));
|
|
|
2 |
|
3 |
export async function POST(req: NextRequest) {
|
4 |
try {
|
5 |
+
const admin=process.env.ADMIN
|
6 |
+
const token=process.env.SHUI_XIAN_TOKEN
|
7 |
+
const user=req.nextUrl.searchParams.get("user")
|
8 |
+
const password=req.nextUrl.searchParams.get("password")
|
9 |
+
const name=req.nextUrl.searchParams.get("name")
|
10 |
+
const formData = new FormData();
|
11 |
+
formData.append("user",String(admin))
|
12 |
+
formData.append("command","user_add")
|
13 |
+
formData.append("api_user",String(user))
|
14 |
+
formData.append("password",String(password))
|
15 |
+
formData.append("name",String(name))
|
16 |
+
let res=await fetch("https://dujiaoka.dwzynj.top/main/api/user/admin_user.php", {
|
17 |
+
method: "POST",
|
18 |
+
headers:{
|
19 |
+
"token":String(token)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
},
|
21 |
+
body:formData
|
22 |
+
})
|
23 |
+
let msg=await res.json()
|
24 |
+
return new Response(JSON.stringify(msg))
|
25 |
} catch (e) {
|
26 |
console.error("[shuixian] ", e);
|
27 |
return new Response(JSON.stringify(e));
|
app/components/register.module.scss
CHANGED
@@ -100,4 +100,9 @@
|
|
100 |
display: inline;
|
101 |
margin: 0 auto;
|
102 |
font-size: 8px;
|
|
|
|
|
|
|
|
|
|
|
103 |
}
|
|
|
100 |
display: inline;
|
101 |
margin: 0 auto;
|
102 |
font-size: 8px;
|
103 |
+
}
|
104 |
+
|
105 |
+
.title{
|
106 |
+
font-size: 4px;
|
107 |
+
color: red;
|
108 |
}
|
app/components/register.tsx
CHANGED
@@ -84,6 +84,7 @@ export function Register(){
|
|
84 |
<div>
|
85 |
<div className={styles.register}>
|
86 |
<div><ChatIcon></ChatIcon></div>
|
|
|
87 |
<div>
|
88 |
<input
|
89 |
type="input"
|
@@ -111,7 +112,7 @@ export function Register(){
|
|
111 |
value={password}
|
112 |
></input>
|
113 |
</div>
|
114 |
-
<div>
|
115 |
<input
|
116 |
type="input"
|
117 |
className={styles.name}
|
@@ -136,7 +137,7 @@ export function Register(){
|
|
136 |
getMailCode()
|
137 |
}}
|
138 |
></IconButton>
|
139 |
-
</div>
|
140 |
<div>
|
141 |
<span className={styles.wangji}><a href="/#/findpwd">{Locale.User.Findpwd}</a></span>
|
142 |
<span className={styles.zhuce}><a href="/#/login">{Locale.User.Login}</a></span>
|
|
|
84 |
<div>
|
85 |
<div className={styles.register}>
|
86 |
<div><ChatIcon></ChatIcon></div>
|
87 |
+
<div className={styles.title}>账号为QQ号将自动绑定QQ邮箱方便找回密码</div>
|
88 |
<div>
|
89 |
<input
|
90 |
type="input"
|
|
|
112 |
value={password}
|
113 |
></input>
|
114 |
</div>
|
115 |
+
{/* <div>
|
116 |
<input
|
117 |
type="input"
|
118 |
className={styles.name}
|
|
|
137 |
getMailCode()
|
138 |
}}
|
139 |
></IconButton>
|
140 |
+
</div> */}
|
141 |
<div>
|
142 |
<span className={styles.wangji}><a href="/#/findpwd">{Locale.User.Findpwd}</a></span>
|
143 |
<span className={styles.zhuce}><a href="/#/login">{Locale.User.Login}</a></span>
|
app/store/user.ts
CHANGED
@@ -163,11 +163,7 @@ export const useUserStore = create<UserStore>()(
|
|
163 |
"&password=" +
|
164 |
password +
|
165 |
"&name=" +
|
166 |
-
name
|
167 |
-
"&mail=" +
|
168 |
-
mail +
|
169 |
-
"&code=" +
|
170 |
-
code,
|
171 |
{
|
172 |
method: "POST",
|
173 |
},
|
|
|
163 |
"&password=" +
|
164 |
password +
|
165 |
"&name=" +
|
166 |
+
name,
|
|
|
|
|
|
|
|
|
167 |
{
|
168 |
method: "POST",
|
169 |
},
|