|
|
@@ -125,8 +125,8 @@ const factory = (crowi) => {
|
|
|
const len = 12;
|
|
|
|
|
|
for (let i = 0; i < len; i++) {
|
|
|
- const randomPoz = Math.floor(Math.random() * chars.length);
|
|
|
- password += chars.substring(randomPoz, randomPoz + 1);
|
|
|
+ const randomIndex = crypto.randomInt(0, chars.length);
|
|
|
+ password += chars[randomIndex];
|
|
|
}
|
|
|
|
|
|
return password;
|
|
|
@@ -567,8 +567,8 @@ const factory = (crowi) => {
|
|
|
const newUser = new User();
|
|
|
|
|
|
/* eslint-disable newline-per-chained-call */
|
|
|
- const tmpUsername = `temp_${Math.random().toString(36).slice(-16)}`;
|
|
|
- const password = Math.random().toString(36).slice(-16);
|
|
|
+ const tmpUsername = `temp_${crypto.randomBytes(8).toString('hex')}`;
|
|
|
+ const password = crypto.randomBytes(12).toString('hex');
|
|
|
/* eslint-enable newline-per-chained-call */
|
|
|
|
|
|
newUser.username = tmpUsername;
|