|
|
|
@ -14,6 +14,9 @@ module ::Recaptcha |
|
|
|
|
# Require authenticated user from the core to be present |
|
|
|
|
before_action :require_authenticated_user |
|
|
|
|
|
|
|
|
|
# Skip if user is admin |
|
|
|
|
before_action :skip_if_admin |
|
|
|
|
|
|
|
|
|
# Skip if user has confirmed already |
|
|
|
|
before_action :skip_if_user_verified |
|
|
|
|
|
|
|
|
@ -90,6 +93,12 @@ module ::Recaptcha |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def skip_if_admin |
|
|
|
|
if @authenticated_user&.admin? |
|
|
|
|
complete_stage_redirect |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def skip_if_user_verified |
|
|
|
|
if ::Recaptcha::Entry.where(user_id: @authenticated_user.id).exists? |
|
|
|
|
Rails.logger.debug { "User #{@authenticated_user.id} already provided recaptcha. Skipping. " } |
|
|
|
|