From a85352282d009b5ac1e38bc2905b544684cc0f20 Mon Sep 17 00:00:00 2001 From: moustachu Date: Fri, 8 Dec 2023 20:52:15 +0100 Subject: [PATCH] fix: omniauth users are confirmed directly at sign up --- ...omniauth_registrations_controller_override.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/controllers/decidim/omniauth_registrations_controller_override.rb b/app/controllers/decidim/omniauth_registrations_controller_override.rb index 3a7848a..d80a25e 100644 --- a/app/controllers/decidim/omniauth_registrations_controller_override.rb +++ b/app/controllers/decidim/omniauth_registrations_controller_override.rb @@ -21,6 +21,22 @@ def after_sign_in_path_for(user) super end end + + private + + def verified_email + @verified_email ||= find_verified_email + end + + def find_verified_email + if oauth_data.present? + session["oauth_data.verified_email"] = oauth_data.dig(:info, :email) + else + email_from_session = session["oauth_data.verified_email"] + session.delete("oauth_data.verified_email") + email_from_session + end + end end end end