Implement safe crypto
This commit is contained in:
@@ -16,7 +16,11 @@ export const resetPassword = async (email: string) => {
|
||||
return { error: "Nutzer nicht gefunden" };
|
||||
}
|
||||
|
||||
const password = Math.random().toString(36).slice(-8);
|
||||
const array = new Uint8Array(8);
|
||||
crypto.getRandomValues(array);
|
||||
const password = Array.from(array, (byte) =>
|
||||
("0" + (byte % 36).toString(36)).slice(-1),
|
||||
).join("");
|
||||
const hashedPassword = await bcrypt.hash(password, 12);
|
||||
await prisma.user.update({
|
||||
where: {
|
||||
|
||||
Reference in New Issue
Block a user