mirror of
https://github.com/4ev-link/4ev.link.git
synced 2026-01-13 16:18:05 +00:00
Fix: Ensure Argon2 library loads before use
This commit is contained in:
@@ -7,7 +7,6 @@
|
|||||||
<script src="https://cdn.tailwindcss.com"></script>
|
<script src="https://cdn.tailwindcss.com"></script>
|
||||||
<script defer src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
<script defer src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
||||||
<script src="https://unpkg.com/lucide@latest"></script>
|
<script src="https://unpkg.com/lucide@latest"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/argon2-browser@1.18.0/dist/argon2-browser.min.js"></script>
|
|
||||||
</head>
|
</head>
|
||||||
<body class="bg-slate-900 text-slate-200 min-h-screen flex items-center justify-center font-sans overflow-hidden">
|
<body class="bg-slate-900 text-slate-200 min-h-screen flex items-center justify-center font-sans overflow-hidden">
|
||||||
|
|
||||||
@@ -80,6 +79,7 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>lucide.createIcons();</script>
|
<script>lucide.createIcons();</script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/argon2-browser@1.18.0/dist/argon2-browser.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
function authForm(){return{username:"",password:"",error:"",loading:!1,async submit(e){this.loading=!0,this.error="";try{const s=this.username.padEnd(16,"0").substring(0,16),t=await argon2.hash({pass:this.password,salt:s}),a=await fetch(`/api/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:this.username,pass_hash:t.hex})});if(!a.ok)throw new Error(await a.text()||"An error occurred");sessionStorage.setItem("pass_hash",t.hex),sessionStorage.setItem("username",this.username),window.location.href="/dash.html"}catch(s){this.error=s.message}finally{this.loading=!1}}}}
|
function authForm(){return{username:"",password:"",error:"",loading:!1,async submit(e){this.loading=!0,this.error="";try{const s=this.username.padEnd(16,"0").substring(0,16),t=await argon2.hash({pass:this.password,salt:s}),a=await fetch(`/api/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:this.username,pass_hash:t.hex})});if(!a.ok)throw new Error(await a.text()||"An error occurred");sessionStorage.setItem("pass_hash",t.hex),sessionStorage.setItem("username",this.username),window.location.href="/dash.html"}catch(s){this.error=s.message}finally{this.loading=!1}}}}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user