mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-10 04:32:35 +01:00
Prevent demo user from enabling 2FA
This commit is contained in:
parent
e2827a332f
commit
5f5bed0db3
@ -17,7 +17,9 @@ export interface TotpEnableSchema {
|
||||
router.post("/", route({ body: "TotpEnableSchema" }), async (req: Request, res: Response) => {
|
||||
const body = req.body as TotpEnableSchema;
|
||||
|
||||
const user = await User.findOneOrFail({ where: { id: req.user_id }, select: ["data"] });
|
||||
const user = await User.findOneOrFail({ where: { id: req.user_id }, select: ["data", "email"] });
|
||||
|
||||
if (user.email == "demo@maddy.k.vu") throw new HTTPError("Demo user, sorry", 400);
|
||||
|
||||
// TODO: Are guests allowed to enable 2fa?
|
||||
if (user.data.hash) {
|
||||
|
Loading…
Reference in New Issue
Block a user