File tree 2 files changed +6
-3
lines changed
usr-web/src/routes/(apps)/attendance
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ async fn add_attendance(
22
22
State ( state) : State < & ' static UsrState > ,
23
23
Form ( CheckIn { uid } ) : Form < CheckIn > ,
24
24
) -> ( StatusCode , & ' static str ) {
25
- let Some ( uid) = uid. strip_prefix ( 'u' ) else {
25
+ let Some ( uid) = uid. strip_prefix ( 'u' ) . or_else ( || uid . strip_prefix ( 'U' ) ) else {
26
26
return ( StatusCode :: BAD_REQUEST , "" ) ;
27
27
} ;
28
28
let Ok ( uid) = uid. parse :: < u32 > ( ) else {
Original file line number Diff line number Diff line change 1
1
<script lang =ts >
2
2
import { PUBLIC_API_ENDPOINT } from ' $env/static/public' ;
3
+ let uid = $state (" " );
3
4
</script >
4
5
5
6
<!-- This iframe prevents redirection -->
9
10
<form method ="POST" action =" {PUBLIC_API_ENDPOINT }/api/attendance/add/attendance" target =" dummyframe" >
10
11
<label >
11
12
uID
12
- <input name =" uid" placeholder =" u1234567" pattern =" u[ 0-9]+" />
13
+ <input name ="uid" placeholder ="u1234567" pattern ="^[uU][ 0-9]+$" bind:value ={ uid } />
13
14
</label >
14
15
<button onclick ={() => {
15
- alert (" Checked In" );
16
+ if (/ ^ [uU][0-9 ] + $ / .test (uid )) {
17
+ alert (" Checked In" );
18
+ }
16
19
}}>Check in</button >
17
20
</form >
18
21
You can’t perform that action at this time.
0 commit comments