mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
refactor(api): 🎨 Don't use node:crypto for random strings
This commit is contained in:
parent
d8cb1d475b
commit
d301d4da09
12 changed files with 37 additions and 35 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { randomBytes } from "node:crypto";
|
||||
import { idValidator } from "@/api";
|
||||
import { getBestContentType, urlToContentFormat } from "@/content_types";
|
||||
import { randomString } from "@/math";
|
||||
import { addUserToMeilisearch } from "@/meilisearch";
|
||||
import { proxyUrl } from "@/response";
|
||||
import { EntityValidator } from "@lysand-org/federation";
|
||||
|
|
@ -190,7 +190,7 @@ export class User extends BaseInterface<typeof Users, UserWithRelations> {
|
|||
}
|
||||
|
||||
async resetPassword() {
|
||||
const resetToken = await randomBytes(32).toString("hex");
|
||||
const resetToken = randomString(32, "hex");
|
||||
|
||||
await this.update({
|
||||
passwordResetToken: resetToken,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue