From 489fb9562b4ccd6a5bf9d66d0bc17e841f9a8c5e Mon Sep 17 00:00:00 2001 From: xbgmsharp Date: Wed, 10 Jan 2024 22:39:16 +0100 Subject: [PATCH] Trigger email otp validation only if the user is not coming for the oauth server --- initdb/02_3_1_signalk_public_tables.sql | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/initdb/02_3_1_signalk_public_tables.sql b/initdb/02_3_1_signalk_public_tables.sql index 2a4d331..1d1b72b 100644 --- a/initdb/02_3_1_signalk_public_tables.sql +++ b/initdb/02_3_1_signalk_public_tables.sql @@ -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$ 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; END; $new_account_otp_validation_entry$ language plpgsql;