We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 6514c5a + 08cbe80 commit 882d46eCopy full SHA for 882d46e
1 file changed
src/app/api/users/signup/route.ts
@@ -40,8 +40,16 @@ export async function POST(request: NextRequest) {
40
);
41
}
42
43
- const password = crypto.randomBytes(8).toString('hex');
44
-
+ let randomBytes = crypto.randomBytes(8);
+ const specialChars = "!@#$%^&*()_+~`|}{[]\:;?><,./-=";
45
+ const allChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" + specialChars;
46
+
47
+ for (let i = 0; i < randomBytes.length; i++) {
48
+ randomBytes[i] = allChars.charCodeAt(randomBytes[i] % allChars.length);
49
+ }
50
51
+ let password = randomBytes.toString('utf-8');
52
+ // console.log(password);
53
54
// Hash password before saving to DB
55
const salt = await bcryptjs.genSalt(10);
0 commit comments