Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
941bdc3
Added logic to replace html-characters.
thomasb202 Mar 23, 2026
28101f0
Added logic to replace html-characters.
thomasb202 Mar 23, 2026
9a210fc
Merge pull request #1 from thomasb202/issue_222
thomasb202 Mar 23, 2026
3b5ad71
Add test for filtering sign off lines
smarr Apr 8, 2026
ba2557d
Added test cases to test the escaping of html
thomasb202 Apr 15, 2026
166d470
Added Database changes.
thomasb202 Apr 23, 2026
425d203
Added Appuser table
thomasb202 Apr 28, 2026
2c0e1f0
Added Appuser table
thomasb202 Apr 28, 2026
71d0c9e
Added jwt, bcrypt,
thomasb202 Apr 28, 2026
fb248b1
Implemented method withUserContext
thomasb202 Apr 28, 2026
c00dc3a
Created Test-Cases for User and Project Membership
thomasb202 Apr 28, 2026
b5f5fe7
Created Test-Cases RLS-policies
thomasb202 Apr 28, 2026
21a4d05
Added db.withUserContext to appropriate methods
thomasb202 Apr 28, 2026
e88b71b
Added requireAuth to appropriate routes
thomasb202 Apr 28, 2026
ca8b093
Implement withUserContext
thomasb202 Apr 28, 2026
a867ddd
Implement UserContextStorage to store userId/token
thomasb202 Apr 28, 2026
acb22e1
Added db.withUserContext
thomasb202 Apr 28, 2026
bf60451
Middleware for jsonwebtoken
thomasb202 Apr 28, 2026
2c4cc7b
Methods for User-Authentication
thomasb202 Apr 28, 2026
3a88c72
Methods for User-handling in db
thomasb202 Apr 28, 2026
5fed7b0
Minimal version of login page.
thomasb202 Apr 28, 2026
28e5ee4
Added jwt secret to docker-compose.yml
thomasb202 Apr 28, 2026
3d19ec2
Remove app_current_user_id() is NULL bypass
thomasb202 May 10, 2026
894d956
Remove app_currenr_user_id() is NULL bypass
thomasb202 May 10, 2026
ac9c156
Add minimal login page
thomasb202 May 10, 2026
108fec2
Redirect to login page
thomasb202 May 10, 2026
ff24900
Merge remote-tracking branch 'origin/M1_Database' into M1_Database
thomasb202 May 10, 2026
2099670
Merge branch 'master' into M1_Database
thomasb202 May 10, 2026
e68b383
Merge pull request #2 from thomasb202/M1_Database
thomasb202 May 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ services:
RDB_DB: rebenchdb
RDB_PORT: 5432
REFRESH_SECRET: refresh
JWT_SECRET: dev-secret-change-in-production
DEV: true
depends_on:
- postgres
Expand Down
174 changes: 174 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
"@octokit/auth-app": "8.2.0",
"@octokit/rest": "22.0.1",
"@sgratzl/chartjs-chart-boxplot": "4.4.5",
"bcrypt": "^6.0.0",
"canvas": "3.2.3",
"chart.js": "4.5.1",
"chartjs-plugin-annotation": "3.1.0",
"decimal.js": "10.6.0",
"ejs": "5.0.2",
"join-images": "1.1.5",
"jsonwebtoken": "^9.0.3",
"koa": "3.2.0",
"koa-body": "7.0.1",
"pg": "8.20.0",
Expand All @@ -40,6 +42,9 @@
"devDependencies": {
"@eslint/js": "10.0.1",
"@octokit/types": "16.0.0",
"@types/bcrypt": "^6.0.0",
"@types/ejs": "3.1.5",
"@types/jsonwebtoken": "^9.0.10",
"@types/jquery": "4.0.0",
"@types/koa": "3.0.2",
"@types/koa__router": "12.0.5",
Expand Down
50 changes: 50 additions & 0 deletions src/backend/auth/auth-db.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import type { Database } from '../db/db.js';
Comment thread
smarr marked this conversation as resolved.

export interface AppUser {
id: number;
username: string;
email: string;
password_hash: string;
created_at: Date;
is_active: boolean;
}

export async function getUserByUsername(
db: Database,
username: string
): Promise<AppUser | null> {
const result = await db.query<AppUser>({
name: 'getUserByUsername',
text: 'SELECT * FROM appuser WHERE username = $1',
values: [username]
});
return result.rows[0] ?? null;
}

export async function getUserByEmail(
db: Database,
email: string
): Promise<AppUser | null> {
const result = await db.query<AppUser>({
name: 'getUserByEmail',
text: 'SELECT * FROM appuser WHERE email = $1',
values: [email]
});
return result.rows[0] ?? null;
}

export async function createUser(
db: Database,
username: string,
email: string,
passwordHash: string
): Promise<AppUser> {
const result = await db.query<AppUser>({
name: 'createUser',
text: `INSERT INTO appuser (username, email, password_hash)
VALUES ($1, $2, $3)
RETURNING *`,
values: [username, email, passwordHash]
});
return result.rows[0];
}
Loading
Loading