Skip to content
This repository has been archived by the owner on Jun 23, 2024. It is now read-only.

Commit

Permalink
feat: start working on actual auth
Browse files Browse the repository at this point in the history
  • Loading branch information
uhidontkno committed Jun 11, 2024
1 parent 04f1937 commit d7ae2bf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
11 changes: 8 additions & 3 deletions frontend/src/lib/components/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import md5 from "md5";
import sha256 from "sha256";
let passwordRegex = new RegExp("^(?=.*[a-z])(?=.*\\d).{10,}$")

async function onAuthClick() {
async function onAuthClick(action:"signup" | "login") {
// @ts-expect-error
let pwd = document.querySelector("input[type=\"password\"]").value
// @ts-expect-error
Expand All @@ -27,7 +27,10 @@ async function onAuthClick() {
}
usr = "md5:"+md5(usr)
pwd = "sha256:"+sha256.x2(pwd)

switch (action) {
case "signup": {break;}
case "login": {break;}
}
}

export default async () => {
Expand All @@ -39,7 +42,9 @@ export default async () => {
// @ts-expect-error
document.querySelector('.authtrigger').onclick = async (e: any) => {
e.preventDefault();
await onAuthClick();
let action = document.location.pathname.slice(1)
if (action != "signup" && action != "login") {return;}
await onAuthClick(action);
};
}
}, 500);
Expand Down
9 changes: 8 additions & 1 deletion frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,12 @@ export default defineConfig({
strict: false,
allow: ['.', 'node_modules', 'node_modules/@sveltejs/kit/src/runtime/client']
}
}

},
esbuild: {
jsxFactory: 'h',
jsxFragment: 'Fragment',
// Add TypeScript support
loader: 'tsx',
},
});

0 comments on commit d7ae2bf

Please sign in to comment.