@@ -107,38 +107,39 @@ export default function LoginPage({
107107 </ TabsList >
108108
109109 < TabsContent value = "user" className = "mt-4" >
110- < FieldGroup >
111- < Field >
112- < FieldLabel htmlFor = "user-email" > 账号</ FieldLabel >
113- < Input
114- value = { userEmail }
115- placeholder = "monkeycode@example.com"
116- onChange = { ( e ) => setUserEmail ( e . target . value ) }
117- id = "user-email"
118- type = "email"
119- required
120- disabled = { logging }
121- />
122- </ Field >
123- < Field >
124- < div className = "flex flex-row items-center justify-between" >
125- < FieldLabel htmlFor = "user-password" > 密码</ FieldLabel >
126- < Link to = "/findpassword" className = "text-sm text-muted-foreground hover:underline" >
127- 找回密码
128- </ Link >
129- </ div >
130- < Input
131- value = { userPassword }
132- placeholder = "************"
133- onChange = { ( e ) => setUserPassword ( e . target . value ) }
134- id = "user-password"
135- type = "password"
136- required
137- disabled = { logging }
138- />
139- </ Field >
140- < Field >
141- < Button onClick = { handleUserLogin } disabled = { logging } variant = "outline" >
110+ < form onSubmit = { ( e ) => { e . preventDefault ( ) ; handleUserLogin ( ) ; } } >
111+ < FieldGroup >
112+ < Field >
113+ < FieldLabel htmlFor = "user-email" > 账号</ FieldLabel >
114+ < Input
115+ value = { userEmail }
116+ placeholder = "monkeycode@example.com"
117+ onChange = { ( e ) => setUserEmail ( e . target . value ) }
118+ id = "user-email"
119+ type = "email"
120+ required
121+ disabled = { logging }
122+ />
123+ </ Field >
124+ < Field >
125+ < div className = "flex flex-row items-center justify-between" >
126+ < FieldLabel htmlFor = "user-password" > 密码</ FieldLabel >
127+ < Link to = "/findpassword" className = "text-sm text-muted-foreground hover:underline" >
128+ 找回密码
129+ </ Link >
130+ </ div >
131+ < Input
132+ value = { userPassword }
133+ placeholder = "************"
134+ onChange = { ( e ) => setUserPassword ( e . target . value ) }
135+ id = "user-password"
136+ type = "password"
137+ required
138+ disabled = { logging }
139+ />
140+ </ Field >
141+ < Field >
142+ < Button type = "submit" disabled = { logging } variant = "outline" >
142143 { logging && < Spinner className = "mr-2" /> }
143144 登录
144145 </ Button >
@@ -153,40 +154,43 @@ export default function LoginPage({
153154 </ Button >
154155 </ div >
155156 </ FieldGroup >
157+ </ form >
156158 </ TabsContent >
157159 < TabsContent value = "manager" className = "mt-4" >
158- < FieldGroup >
159- < Field >
160- < FieldLabel htmlFor = "email" > 账号</ FieldLabel >
161- < Input
162- value = { teamManagerEmail }
163- placeholder = "monkeycode@example.com"
164- onChange = { ( e ) => setTeamManagerEmail ( e . target . value ) }
165- id = "email"
166- type = "email"
167- required
168- disabled = { logging }
169- />
170- </ Field >
171- < Field >
172- < FieldLabel htmlFor = "password" > 密码</ FieldLabel >
173- < Input
174- id = "password"
175- placeholder = "************"
176- type = "password"
177- required
178- disabled = { logging }
179- value = { teamManagerPassword }
180- onChange = { ( e ) => setTeamManagerPassword ( e . target . value ) }
181- />
182- </ Field >
183- < Field >
184- < Button onClick = { handleTeamManagerLogin } disabled = { logging } >
160+ < form onSubmit = { ( e ) => { e . preventDefault ( ) ; handleTeamManagerLogin ( ) ; } } >
161+ < FieldGroup >
162+ < Field >
163+ < FieldLabel htmlFor = "email" > 账号</ FieldLabel >
164+ < Input
165+ value = { teamManagerEmail }
166+ placeholder = "monkeycode@example.com"
167+ onChange = { ( e ) => setTeamManagerEmail ( e . target . value ) }
168+ id = "email"
169+ type = "email"
170+ required
171+ disabled = { logging }
172+ />
173+ </ Field >
174+ < Field >
175+ < FieldLabel htmlFor = "password" > 密码</ FieldLabel >
176+ < Input
177+ id = "password"
178+ placeholder = "************"
179+ type = "password"
180+ required
181+ disabled = { logging }
182+ value = { teamManagerPassword }
183+ onChange = { ( e ) => setTeamManagerPassword ( e . target . value ) }
184+ />
185+ </ Field >
186+ < Field >
187+ < Button type = "submit" disabled = { logging } >
185188 { logging && < Spinner /> }
186189 登录
187190 </ Button >
188191 </ Field >
189192 </ FieldGroup >
193+ </ form >
190194 </ TabsContent >
191195 </ Tabs >
192196 </ CardContent >
0 commit comments