-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): Use JWT as reset password token (#6714)
* use jwt to reset password * increase expiration time to 1d * drop user id query string * refactor * use service instead of package in tests * sqlite migration * postgres migration * mysql migration * remove unused properties * remove userId from FE * fix test for users.api * move migration to the common folder * move type assertion to the jwt.service * Add jwt secret as a readonly property * use signData instead of sign in user.controller * remove base class * remove base class * add tests
- Loading branch information
1 parent
c2511a8
commit 89f4402
Showing
19 changed files
with
209 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
packages/cli/src/databases/migrations/common/1690000000030-RemoveResetPasswordColumns.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import type { MigrationContext, ReversibleMigration } from '@db/types'; | ||
import { TableColumn } from 'typeorm'; | ||
|
||
export class RemoveResetPasswordColumns1690000000030 implements ReversibleMigration { | ||
async up({ queryRunner, tablePrefix }: MigrationContext) { | ||
await queryRunner.dropColumn(`${tablePrefix}user`, 'resetPasswordToken'); | ||
await queryRunner.dropColumn(`${tablePrefix}user`, 'resetPasswordTokenExpiration'); | ||
} | ||
|
||
async down({ queryRunner, tablePrefix }: MigrationContext) { | ||
await queryRunner.addColumn( | ||
`${tablePrefix}user`, | ||
new TableColumn({ | ||
name: 'resetPasswordToken', | ||
type: 'varchar', | ||
isNullable: true, | ||
}), | ||
); | ||
|
||
await queryRunner.addColumn( | ||
`${tablePrefix}user`, | ||
new TableColumn({ | ||
name: 'resetPasswordTokenExpiration', | ||
type: 'int', | ||
isNullable: true, | ||
}), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.