mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
fix: Change Password in User Profile
This commit is contained in:
parent
6519e3487b
commit
55d85a8ccf
@ -1,3 +1,6 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||||
|
|
||||||
import { Resolver, Query, Arg, Args, Authorized, Mutation, Ctx } from 'type-graphql'
|
import { Resolver, Query, Arg, Args, Authorized, Mutation, Ctx } from 'type-graphql'
|
||||||
import { getCustomRepository, Raw } from 'typeorm'
|
import { getCustomRepository, Raw } from 'typeorm'
|
||||||
import { UserAdmin } from '../model/UserAdmin'
|
import { UserAdmin } from '../model/UserAdmin'
|
||||||
|
|||||||
@ -738,7 +738,7 @@ export class UserResolver {
|
|||||||
if (password && passwordNew) {
|
if (password && passwordNew) {
|
||||||
// TODO: This had some error cases defined - like missing private key. This is no longer checked.
|
// TODO: This had some error cases defined - like missing private key. This is no longer checked.
|
||||||
const oldPasswordHash = SecretKeyCryptographyCreateKey(loginUser.email, password)
|
const oldPasswordHash = SecretKeyCryptographyCreateKey(loginUser.email, password)
|
||||||
if (loginUser.password !== oldPasswordHash[0].readBigUInt64LE()) {
|
if (BigInt(loginUser.password.toString()) !== oldPasswordHash[0].readBigUInt64LE()) {
|
||||||
throw new Error(`Old password is invalid`)
|
throw new Error(`Old password is invalid`)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -748,7 +748,7 @@ export class UserResolver {
|
|||||||
const encryptedPrivkey = SecretKeyCryptographyEncrypt(privKey, newPasswordHash[1])
|
const encryptedPrivkey = SecretKeyCryptographyEncrypt(privKey, newPasswordHash[1])
|
||||||
|
|
||||||
// Save new password hash and newly encrypted private key
|
// Save new password hash and newly encrypted private key
|
||||||
loginUser.password = newPasswordHash[0].readBigInt64LE()
|
loginUser.password = newPasswordHash[0].readBigUInt64LE()
|
||||||
loginUser.privKey = encryptedPrivkey
|
loginUser.privKey = encryptedPrivkey
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user