File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
usr-web/src/routes/(apps)/attendance Expand file tree Collapse file tree 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(
2222 State ( state) : State < & ' static UsrState > ,
2323 Form ( CheckIn { uid } ) : Form < CheckIn > ,
2424) -> ( 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 {
2626 return ( StatusCode :: BAD_REQUEST , "" ) ;
2727 } ;
2828 let Ok ( uid) = uid. parse :: < u32 > ( ) else {
Original file line number Diff line number Diff line change 11<script lang =ts >
22 import { PUBLIC_API_ENDPOINT } from ' $env/static/public' ;
3+ let uid = $state (" " );
34 </script >
45
56<!-- This iframe prevents redirection -->
910<form method ="POST" action =" {PUBLIC_API_ENDPOINT }/api/attendance/add/attendance" target =" dummyframe" >
1011 <label >
1112 uID
12- <input name =" uid" placeholder =" u1234567" pattern =" u[ 0-9]+" />
13+ <input name ="uid" placeholder ="u1234567" pattern ="^[uU][ 0-9]+$" bind:value ={ uid } />
1314 </label >
1415 <button onclick ={() => {
15- alert (" Checked In" );
16+ if (/ ^ [uU][0-9 ] + $ / .test (uid )) {
17+ alert (" Checked In" );
18+ }
1619 }}>Check in</button >
1720</form >
1821
You can’t perform that action at this time.
0 commit comments