mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-23 22:33:57 +08:00
deleting user if captcha fails
This commit is contained in:
parent
5836a0a974
commit
e16634dad4
1 changed files with 10 additions and 1 deletions
|
@ -25,7 +25,16 @@ export async function createNewUser(
|
|||
const { name, captcha } = req.body;
|
||||
const { email, uid } = req.ctx.decodedToken;
|
||||
|
||||
await verifyCaptcha(captcha);
|
||||
try {
|
||||
await verifyCaptcha(captcha);
|
||||
} catch (e) {
|
||||
try {
|
||||
await admin.auth().deleteUser(uid);
|
||||
} catch (e) {
|
||||
// user might be deleted on the frontend
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
if (email.endsWith("@tidal.lol") || email.endsWith("@selfbot.cc")) {
|
||||
throw new MonkeyError(400, "Invalid domain");
|
||||
|
|
Loading…
Reference in a new issue