refactor: fix password auth
refactor: move tabs around
This commit is contained in:
parent
316663be32
commit
e397bc884b
17 changed files with 49 additions and 26 deletions
|
@ -34,7 +34,7 @@
|
|||
"imports": {
|
||||
"@andyburke/fsdb": "jsr:@andyburke/fsdb@^1.0.0",
|
||||
"@andyburke/lurid": "jsr:@andyburke/lurid@^0.2.0",
|
||||
"@andyburke/serverus": "jsr:@andyburke/serverus@^0.7.1",
|
||||
"@andyburke/serverus": "jsr:@andyburke/serverus@^0.9.3",
|
||||
"@da/bcrypt": "jsr:@da/bcrypt@^1.0.1",
|
||||
"@std/assert": "jsr:@std/assert@^1.0.13",
|
||||
"@std/encoding": "jsr:@std/encoding@^1.0.10",
|
||||
|
|
17
deno.lock
generated
17
deno.lock
generated
|
@ -4,8 +4,7 @@
|
|||
"jsr:@andyburke/fsdb@1": "1.0.0",
|
||||
"jsr:@andyburke/lurid@*": "0.2.0",
|
||||
"jsr:@andyburke/lurid@0.2": "0.2.0",
|
||||
"jsr:@andyburke/serverus@*": "0.7.1",
|
||||
"jsr:@andyburke/serverus@~0.7.1": "0.7.1",
|
||||
"jsr:@andyburke/serverus@~0.9.3": "0.9.3",
|
||||
"jsr:@da/bcrypt@^1.0.1": "1.0.1",
|
||||
"jsr:@std/assert@*": "1.0.13",
|
||||
"jsr:@std/assert@^1.0.13": "1.0.13",
|
||||
|
@ -52,16 +51,16 @@
|
|||
"jsr:@std/cli@^1.0.19"
|
||||
]
|
||||
},
|
||||
"@andyburke/serverus@0.7.1": {
|
||||
"integrity": "750b5d425a3b147efb551fbbc564b0c1428e5a8b94959bd77e95936bab78040d",
|
||||
"@andyburke/serverus@0.9.3": {
|
||||
"integrity": "fb72135b96e9700f6b4959d9fcbcbf8dfeef9ed97cd510709c59304d7fef59d5",
|
||||
"dependencies": [
|
||||
"jsr:@std/async",
|
||||
"jsr:@std/cli@^1.0.19",
|
||||
"jsr:@std/cli@^1.0.20",
|
||||
"jsr:@std/fmt@^1.0.6",
|
||||
"jsr:@std/fs@^1.0.14",
|
||||
"jsr:@std/http@^1.0.13",
|
||||
"jsr:@std/fs@^1.0.19",
|
||||
"jsr:@std/http@^1.0.19",
|
||||
"jsr:@std/media-types",
|
||||
"jsr:@std/path@^1.0.8"
|
||||
"jsr:@std/path@^1.1.1"
|
||||
]
|
||||
},
|
||||
"@da/bcrypt@1.0.1": {
|
||||
|
@ -207,7 +206,7 @@
|
|||
"dependencies": [
|
||||
"jsr:@andyburke/fsdb@1",
|
||||
"jsr:@andyburke/lurid@0.2",
|
||||
"jsr:@andyburke/serverus@~0.7.1",
|
||||
"jsr:@andyburke/serverus@~0.9.3",
|
||||
"jsr:@da/bcrypt@^1.0.1",
|
||||
"jsr:@std/assert@^1.0.13",
|
||||
"jsr:@std/encoding@^1.0.10",
|
||||
|
|
|
@ -3,7 +3,6 @@ import { FSDB_COLLECTION } from 'jsr:@andyburke/fsdb';
|
|||
export type PASSWORD_ENTRY = {
|
||||
user_id: string;
|
||||
hash: string;
|
||||
salt: string;
|
||||
timestamps: {
|
||||
created: string;
|
||||
updated: string;
|
||||
|
|
|
@ -79,7 +79,7 @@ export async function POST(req: Request, meta: Record<string, any>): Promise<Res
|
|||
});
|
||||
}
|
||||
|
||||
const verified = await bcrypt.compare(`${password_hash}${password_entry.salt}`, password_entry.hash);
|
||||
const verified = await bcrypt.compare(password_hash, password_entry.hash);
|
||||
|
||||
if (!verified) {
|
||||
return Response.json({
|
||||
|
|
|
@ -106,13 +106,12 @@ export async function POST(req: Request, meta: Record<string, any>): Promise<Res
|
|||
|
||||
await USERS.create(user);
|
||||
|
||||
const salt = await bcrypt.genSalt();
|
||||
const hashed_password_value = await bcrypt.hash(password_hash, salt);
|
||||
// automatically salted
|
||||
const hashed_password_value = await bcrypt.hash(password_hash);
|
||||
|
||||
const password_entry: PASSWORD_ENTRY = {
|
||||
user_id: user.id,
|
||||
hash: hashed_password_value,
|
||||
salt,
|
||||
timestamps: {
|
||||
created: now,
|
||||
updated: now
|
||||
|
|
3
public/tabs/calendar/README.md
Normal file
3
public/tabs/calendar/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# calendar
|
||||
|
||||
The calendar should help people coordinate events.
|
|
@ -10,5 +10,7 @@
|
|||
><div class="icon calendar"></div>
|
||||
<div class="label">Calendar</div></label
|
||||
>
|
||||
<div class="tab-content">This is the calendar tab.</div>
|
||||
<div class="tab-content">
|
||||
<!-- #include file="./README.md" -->
|
||||
</div>
|
||||
</div>
|
3
public/tabs/exchange/README.md
Normal file
3
public/tabs/exchange/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# exchange
|
||||
|
||||
The exchange should help people find goods and trade.
|
|
@ -10,5 +10,7 @@
|
|||
><div class="icon exchange"></div>
|
||||
<div class="label">Exchange</div></label
|
||||
>
|
||||
<div class="tab-content">This is the exchange tab.</div>
|
||||
<div class="tab-content">
|
||||
<!-- #include file="./README.md" -->
|
||||
</div>
|
||||
</div>
|
3
public/tabs/home/README.md
Normal file
3
public/tabs/home/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Home
|
||||
|
||||
This tab should show notifications and an overview.
|
|
@ -11,5 +11,7 @@
|
|||
<div class="icon home"></div>
|
||||
<div class="label">Home</div>
|
||||
</label>
|
||||
<div class="tab-content">This is the home tab.</div>
|
||||
<div class="tab-content">
|
||||
<!-- #include file="./README.md" -->
|
||||
</div>
|
||||
</div>
|
3
public/tabs/resources/README.md
Normal file
3
public/tabs/resources/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Resources
|
||||
|
||||
Resources should be a wiki for organizing community knowledge.
|
|
@ -10,5 +10,5 @@
|
|||
><div class="icon resources"></div>
|
||||
<div class="label">Resources</div></label
|
||||
>
|
||||
<div class="tab-content">This is the resources tab.</div>
|
||||
<div class="tab-content"><!-- #include file="./README.md" --></div>
|
||||
</div>
|
|
@ -126,11 +126,11 @@
|
|||
</style>
|
||||
|
||||
<div class="tabs">
|
||||
<!-- #include file="./home.html" -->
|
||||
<!-- #include file="./home/home.html" -->
|
||||
<!-- #include file="./talk/talk.html" -->
|
||||
<!-- #include file="./exchange.html" -->
|
||||
<!-- #include file="./work.html" -->
|
||||
<!-- #include file="./resources.html" -->
|
||||
<!-- #include file="./calendar.html" -->
|
||||
<!-- #include file="./profile.html" -->
|
||||
<!-- #include file="./exchange/exchange.html" -->
|
||||
<!-- #include file="./resources/resources.html" -->
|
||||
<!-- #include file="./calendar/calendar.html" -->
|
||||
<!-- #include file="./work/work.html" -->
|
||||
<!-- #include file="./profile/profile.html" -->
|
||||
</div>
|
||||
|
|
8
public/tabs/work/README.md
Normal file
8
public/tabs/work/README.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
# Work
|
||||
|
||||
This tab should help people find and list work, but without being shitty:
|
||||
|
||||
- Make requirements favor users
|
||||
- Salary required
|
||||
- Location required
|
||||
- Discussions available on listings without poster's control
|
|
@ -10,5 +10,5 @@
|
|||
><div class="icon work"></div>
|
||||
<div class="label">Work</div>
|
||||
</label>
|
||||
<div class="tab-content">This is the work tab.</div>
|
||||
<div class="tab-content"><!-- #include file="./README.md" --></div>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue