|
|
|
@ -2,7 +2,6 @@ import { Request, Response } from "express";
|
|
|
|
|
import { AuthMethod, User } from "../../models";
|
|
|
|
|
import { checkEmailVerification, sendEmailVerification } from "../../helpers/signup";
|
|
|
|
|
import { createToken } from "../../helpers/auth";
|
|
|
|
|
import { BadRequestError } from "../../utils/errors";
|
|
|
|
|
import {
|
|
|
|
|
getAuthSecret,
|
|
|
|
|
getJwtSignupLifetime,
|
|
|
|
@ -67,14 +66,6 @@ export const verifyEmailSignup = async (req: Request, res: Response) => {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Only one user can create an account without being invited. The rest need to be invited in order to make an account
|
|
|
|
|
const userCount = await User.countDocuments({});
|
|
|
|
|
if (userCount != 0) {
|
|
|
|
|
throw BadRequestError({
|
|
|
|
|
message: "New user sign ups are not allowed at this time. You must be invited to sign up."
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// verify email
|
|
|
|
|
if (await getSmtpConfigured()) {
|
|
|
|
|
await checkEmailVerification({
|
|
|
|
|