-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
app/controllers/concerns/scholars_archive/torrent_form_recaptcha_behavior.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# frozen_string_literal: true | ||
|
||
module ScholarsArchive | ||
# CLASS: Torrent Form Recaptcha Controller | ||
module TorrentFormRecaptchaBehavior | ||
# METHOD: Check the recaptcha to see if verify or not | ||
def check_recaptcha | ||
if is_recaptcha? | ||
if verify_recaptcha(model: @torrent_form) | ||
true | ||
else | ||
flash[:error] = 'Captcha did not verify properly.' | ||
false | ||
end | ||
else | ||
true | ||
end | ||
end | ||
|
||
# METHOD: A check method to see if recaptcha exist | ||
# rubocop:disable Naming/PredicateName | ||
def is_recaptcha? | ||
Hyrax.config.recaptcha? | ||
end | ||
# rubocop:enable Naming/PredicateName | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters