Trigger email otp validation only if the user is not coming for the oauth server

This commit is contained in:
xbgmsharp
2024-01-10 22:39:16 +01:00
parent 8c32345342
commit 489fb9562b

View File

@@ -178,7 +178,10 @@ $new_account_entry$ language plpgsql;
create function new_account_otp_validation_entry_fn() returns trigger as $new_account_otp_validation_entry$ create function new_account_otp_validation_entry_fn() returns trigger as $new_account_otp_validation_entry$
begin begin
insert into process_queue (channel, payload, stored, ref_id) values ('email_otp', NEW.email, now(), NEW.user_id); -- Add email_otp check only if not from oauth server
if (NEW.preferences->>'email_verified')::boolean IS NOT True then
insert into process_queue (channel, payload, stored, ref_id) values ('email_otp', NEW.email, now(), NEW.user_id);
end if
return NEW; return NEW;
END; END;
$new_account_otp_validation_entry$ language plpgsql; $new_account_otp_validation_entry$ language plpgsql;