All checks were successful
Build and Push Backend / build (push) Successful in 20s
- Implement register, login, logout, and me endpoints - Use bcryptjs for password hashing - HTTPOnly secure cookies for sessions (Lucia Auth pattern) - Users and sessions tables with proper relations - 7-day session duration with auto-expiry Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
38 lines
767 B
TypeScript
38 lines
767 B
TypeScript
/**
|
|
* Test authentication directly
|
|
*/
|
|
|
|
import { db } from './src/db/client'
|
|
import { users } from './src/db/schema'
|
|
import { randomUUID } from 'crypto'
|
|
import bcrypt from 'bcryptjs'
|
|
|
|
async function testAuth() {
|
|
try {
|
|
console.log('Testing auth...')
|
|
|
|
// Hash password
|
|
const passwordHash = await bcrypt.hash('test123', 10)
|
|
console.log('Password hash:', passwordHash)
|
|
|
|
// Insert user
|
|
const userId = randomUUID()
|
|
console.log('Inserting user with ID:', userId)
|
|
|
|
await db.insert(users).values({
|
|
id: userId,
|
|
email: 'test@test.com',
|
|
username: 'testuser',
|
|
passwordHash,
|
|
})
|
|
|
|
console.log('User inserted successfully!')
|
|
} catch (error) {
|
|
console.error('Error:', error)
|
|
}
|
|
|
|
process.exit(0)
|
|
}
|
|
|
|
testAuth()
|