File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 11{
22 "cSpell.words" : [
33 " instanceof" ,
4+ " minlength" ,
45 " onfocus" ,
56 " sveltejs" ,
67 " sveltekit"
Original file line number Diff line number Diff line change @@ -15,11 +15,12 @@ export const load: PageServerLoad = async ({ locals }) => {
1515export const actions : Actions = {
1616 default : async ( { request } ) => {
1717 const data = await request . formData ( )
18- const username = data . get ( 'username' ) as string
19- const email = data . get ( 'email' ) as string
20- const password = data . get ( 'password' ) as string
18+ const username = data . get ( 'username' ) ?. toString ( ) ?? ''
19+ const email = data . get ( 'email' ) ?. toString ( ) ?? ''
20+ const password = data . get ( 'password' ) ?. toString ( ) ?? ''
21+ const password_is_valid = password . length >= 8
2122
22- if ( ! username || ! email || ! password ) return invalid ( 404 , { missing : true } )
23+ if ( ! username || ! email || ! password_is_valid ) return invalid ( 404 , { missing : true } )
2324
2425 try {
2526 await db . user . create ( {
Original file line number Diff line number Diff line change 2727 bind:this ={username_element }
2828 />
2929 <input type =" email" name =" email" placeholder =" email" required />
30- <input type =" password" name =" password" placeholder =" Password" required />
30+ <input type =" password" name =" password" placeholder =" Password" required minlength = " 8 " />
3131
3232 {#if form ?.missing }<p class ="error" >Username, email and password is required.</p >{/if }
3333 {#if form ?.user_exists }<p class ="error" >Username or email is used.</p >{/if }
You can’t perform that action at this time.
0 commit comments