feat: Add team deletion flow for cloud-hosted (#5717)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import crypto from "crypto";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { URL } from "url";
|
||||
@@ -176,6 +177,22 @@ class Team extends ParanoidModel {
|
||||
return url.href.replace(/\/$/, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a code that can be used to delete the user's team. The code will
|
||||
* be rotated when the user signs out.
|
||||
*
|
||||
* @returns The deletion code.
|
||||
*/
|
||||
public getDeleteConfirmationCode(user: User) {
|
||||
return crypto
|
||||
.createHash("md5")
|
||||
.update(`${this.id}${user.jwtSecret}`)
|
||||
.digest("hex")
|
||||
.replace(/[l1IoO0]/gi, "")
|
||||
.slice(0, 8)
|
||||
.toUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Preferences that decide behavior for the team.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user