Skip to content

Commit

Permalink
solve crypto is not defined error
Browse files Browse the repository at this point in the history
  • Loading branch information
Bardala committed Nov 7, 2023
1 parent 6455c8b commit 4e4fbbc
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions backend/src/controllers/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
UserSpacesReq,
UserSpacesRes,
} from '@nest/shared';
import { randomUUID } from 'node:crypto';
import { getRandomValues, randomUUID } from 'node:crypto';
import validator from 'validator';

import { DataStoreDao } from '../dataStore';
Expand Down Expand Up @@ -208,9 +208,7 @@ export class UserController implements userController {
retVal = '';
for (let i = 0, n = charset.length; i < passwordLength; ++i)
retVal +=
charset[
Math.floor((crypto.getRandomValues(new Uint32Array(1))[0] / (0xffffffff + 1)) * n)
];
charset[Math.floor((getRandomValues(new Uint32Array(1))[0] / (0xffffffff + 1)) * n)];
}

return retVal;
Expand Down

0 comments on commit 4e4fbbc

Please sign in to comment.