fix: auth middleware, JWT_SECRET env guard, and password reset token lookup
This commit is contained in:
@@ -5,12 +5,14 @@ export async function up(knex: Knex): Promise<void> {
|
||||
table.uuid('id').primary().defaultTo(knex.raw('gen_random_uuid()'));
|
||||
table.uuid('user_id').notNullable().references('id').inTable('users').onDelete('CASCADE');
|
||||
table.string('token_hash', 255).notNullable();
|
||||
table.string('lookup_hash', 64).notNullable();
|
||||
table.timestamp('expires_at', { useTz: true }).notNullable();
|
||||
table.timestamp('used_at', { useTz: true }).nullable();
|
||||
table.timestamp('created_at', { useTz: true }).defaultTo(knex.fn.now());
|
||||
});
|
||||
|
||||
await knex.raw(`CREATE INDEX idx_prt_user_id ON password_reset_tokens (user_id)`);
|
||||
await knex.raw(`CREATE UNIQUE INDEX idx_prt_lookup_hash ON password_reset_tokens (lookup_hash)`);
|
||||
}
|
||||
|
||||
export async function down(knex: Knex): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user