Merge pull request #497 from bigcapitalhq/BIG-195

fix: Disable email confirmation does not work with invited users
This commit is contained in:
Ahmed Bouhuolia
2024-06-17 10:34:33 +02:00
committed by GitHub
3 changed files with 21 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
import { Container, Inject } from 'typedi';
import { cloneDeep } from 'lodash';
import { Tenant } from '@/system/models';
import { SystemUser, Tenant } from '@/system/models';
import {
IAuthSignedInEventPayload,
IAuthSigningInEventPayload,
@@ -64,7 +64,9 @@ export class AuthSigninService {
const { systemUserRepository } = this.sysRepositories;
// Finds the user of the given email address.
const user = await systemUserRepository.findOneByEmail(email);
const user = await SystemUser.query()
.findOne('email', email)
.modify('inviteAccepted');
// Validate the given email and password.
await this.validateSignIn(user, email, password);

View File

@@ -46,6 +46,9 @@ export default class SyncSystemSendInvite {
email: user.email,
active: user.active,
tenantId,
// Email should be verified since the user got the invite token through email.
verified: true,
});
// Creates a invite user token.
const invite = await Invite.query().insert({