mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 22:30:31 +00:00
feat: ability to enable/disable email confirmation from env variables
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Inject, Service } from 'typedi';
|
||||
import { ServiceError } from '@/exceptions';
|
||||
import { SystemUser } from '@/system/models';
|
||||
import { Inject, Service } from 'typedi';
|
||||
import { ERRORS } from './_constants';
|
||||
|
||||
@Service()
|
||||
@@ -9,18 +9,19 @@ export class AuthSignupConfirmResend {
|
||||
private agenda: any;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {number} tenantId
|
||||
* @param {string} email
|
||||
* Resends the email confirmation of the given user.
|
||||
* @param {number} userId - User ID.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
public async signUpConfirmResend(userId: number) {
|
||||
const user = await SystemUser.query().findById(userId).throwIfNotFound();
|
||||
|
||||
//
|
||||
// Throw error if the user is already verified.
|
||||
if (user.verified) {
|
||||
throw new ServiceError(ERRORS.USER_ALREADY_VERIFIED);
|
||||
}
|
||||
if (user.verifyToken) {
|
||||
// Throw error if the verification token is not exist.
|
||||
if (!user.verifyToken) {
|
||||
throw new ServiceError(ERRORS.USER_ALREADY_VERIFIED);
|
||||
}
|
||||
const payload = {
|
||||
|
||||
Reference in New Issue
Block a user