mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
generate random private key for those accounts with an intact passphrase
This commit is contained in:
parent
138f09b4e0
commit
54afb80cc2
@ -6,6 +6,15 @@
|
||||
*/
|
||||
|
||||
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
// Generate a random private key where the remaining data is present
|
||||
await queryFn(
|
||||
`UPDATE login_users SET privkey = UNHEX(SHA1(RAND()))
|
||||
WHERE privkey IS NULL
|
||||
AND pubkey IS NOT NULL
|
||||
AND password != 0
|
||||
AND id IN (SELECT user_id FROM login_user_backups);`,
|
||||
)
|
||||
|
||||
// Remove incomplete data and set account as not activated yet.
|
||||
await queryFn(
|
||||
`UPDATE login_users SET password = 0, pubkey = NULL, email_checked = 0 WHERE privkey IS NULL;`,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user