mirror of
https://github.com/Infisical/infisical.git
synced 2026-01-09 15:38:03 -05:00
Fix to remove non verified accounts on account complete flow and fix duplicate account view not showing accounts without any org
This commit is contained in:
@@ -178,6 +178,27 @@ export const authSignupServiceFactory = ({
|
|||||||
|
|
||||||
const hashedPassword = await crypto.hashing().createHash(password, appCfg.SALT_ROUNDS);
|
const hashedPassword = await crypto.hashing().createHash(password, appCfg.SALT_ROUNDS);
|
||||||
const updateduser = await authDAL.transaction(async (tx) => {
|
const updateduser = await authDAL.transaction(async (tx) => {
|
||||||
|
const duplicateUsers = await userDAL.find(
|
||||||
|
{
|
||||||
|
email: user.email || sanitizedEmail,
|
||||||
|
isAccepted: false
|
||||||
|
},
|
||||||
|
{ tx }
|
||||||
|
);
|
||||||
|
const duplicateUserIds = duplicateUsers
|
||||||
|
.filter((duplicateUser) => duplicateUser.id !== user.id)
|
||||||
|
.map((duplicateUser) => duplicateUser.id);
|
||||||
|
if (duplicateUserIds.length > 0) {
|
||||||
|
await userDAL.delete(
|
||||||
|
{
|
||||||
|
$in: {
|
||||||
|
id: duplicateUserIds
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tx
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const us = await userDAL.updateById(user.id, { firstName, lastName, isAccepted: true }, tx);
|
const us = await userDAL.updateById(user.id, { firstName, lastName, isAccepted: true }, tx);
|
||||||
if (!us) throw new Error("User not found");
|
if (!us) throw new Error("User not found");
|
||||||
|
|
||||||
@@ -342,6 +363,27 @@ export const authSignupServiceFactory = ({
|
|||||||
const appCfg = getConfig();
|
const appCfg = getConfig();
|
||||||
const hashedPassword = await crypto.hashing().createHash(password, appCfg.SALT_ROUNDS);
|
const hashedPassword = await crypto.hashing().createHash(password, appCfg.SALT_ROUNDS);
|
||||||
const updateduser = await authDAL.transaction(async (tx) => {
|
const updateduser = await authDAL.transaction(async (tx) => {
|
||||||
|
const duplicateUsers = await userDAL.find(
|
||||||
|
{
|
||||||
|
email: user.email || sanitizedEmail,
|
||||||
|
isAccepted: false
|
||||||
|
},
|
||||||
|
{ tx }
|
||||||
|
);
|
||||||
|
const duplicateUserIds = duplicateUsers
|
||||||
|
.filter((duplicateUser) => duplicateUser.id !== user.id)
|
||||||
|
.map((duplicateUser) => duplicateUser.id);
|
||||||
|
if (duplicateUserIds.length > 0) {
|
||||||
|
await userDAL.delete(
|
||||||
|
{
|
||||||
|
$in: {
|
||||||
|
id: duplicateUserIds
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tx
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const us = await userDAL.updateById(user.id, { firstName, lastName, isAccepted: true }, tx);
|
const us = await userDAL.updateById(user.id, { firstName, lastName, isAccepted: true }, tx);
|
||||||
if (!us) throw new Error("User not found");
|
if (!us) throw new Error("User not found");
|
||||||
const userEncKey = await userDAL.upsertUserEncryptionKey(
|
const userEncKey = await userDAL.upsertUserEncryptionKey(
|
||||||
|
|||||||
@@ -199,8 +199,6 @@ export const userDALFactory = (db: TDbClient) => {
|
|||||||
const doc = await db(TableName.Users)
|
const doc = await db(TableName.Users)
|
||||||
.where({ email })
|
.where({ email })
|
||||||
.leftJoin(TableName.Membership, `${TableName.Membership}.actorUserId`, `${TableName.Users}.id`)
|
.leftJoin(TableName.Membership, `${TableName.Membership}.actorUserId`, `${TableName.Users}.id`)
|
||||||
.where(`${TableName.Membership}.scope`, AccessScope.Organization)
|
|
||||||
.whereNotNull(`${TableName.Membership}.actorUserId`)
|
|
||||||
.leftJoin(TableName.Organization, `${TableName.Organization}.id`, `${TableName.Membership}.scopeOrgId`)
|
.leftJoin(TableName.Organization, `${TableName.Organization}.id`, `${TableName.Membership}.scopeOrgId`)
|
||||||
.select(selectAllTableCols(TableName.Users))
|
.select(selectAllTableCols(TableName.Users))
|
||||||
.select(
|
.select(
|
||||||
|
|||||||
Reference in New Issue
Block a user