mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Merge pull request #4539 from Infisical/fix/enableEmailLoginOnChangeEmails
Enable email login on change of emails flows to avoid blocked users
This commit is contained in:
@@ -294,11 +294,18 @@ export const userServiceFactory = ({
|
||||
// Delete all user aliases since the email is changing
|
||||
await userAliasDAL.delete({ userId }, tx);
|
||||
|
||||
// Ensure EMAIL auth method is included if not already present
|
||||
const currentAuthMethods = user.authMethods || [];
|
||||
const updatedAuthMethods = currentAuthMethods.includes(AuthMethod.EMAIL)
|
||||
? currentAuthMethods
|
||||
: [...currentAuthMethods, AuthMethod.EMAIL];
|
||||
|
||||
const updatedUser = await userDAL.updateById(
|
||||
userId,
|
||||
{
|
||||
email: newEmail.toLowerCase(),
|
||||
username: newEmail.toLowerCase()
|
||||
username: newEmail.toLowerCase(),
|
||||
authMethods: updatedAuthMethods
|
||||
},
|
||||
tx
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user