We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c0b30cf commit a784aa3Copy full SHA for a784aa3
1 file changed
src/app/api/users/signup/route.ts
@@ -40,7 +40,16 @@ export async function POST(request: NextRequest) {
40
);
41
}
42
43
- const password = crypto.randomBytes(8).toString('hex');
+ let randomBytes = crypto.randomBytes(8);
44
+ 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
53
54
55
// Hash password before saving to DB
0 commit comments