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