Module: InvisibleCaptcha
- Defined in:
- lib/invisible_captcha.rb,
lib/invisible_captcha/railtie.rb,
lib/invisible_captcha/version.rb,
lib/invisible_captcha/form_helpers.rb,
lib/invisible_captcha/view_helpers.rb,
lib/invisible_captcha/controller_ext.rb
Defined Under Namespace
Modules: ControllerExt, FormHelpers, ViewHelpers
Classes: Railtie
Constant Summary
collapse
- VERSION =
"0.9.0"
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.error_message ⇒ Object
41
42
43
|
# File 'lib/invisible_captcha.rb', line 41
def error_message
call_lambda_or_return(@error_message)
end
|
.honeypots ⇒ Object
Returns the value of attribute honeypots.
13
14
15
|
# File 'lib/invisible_captcha.rb', line 13
def honeypots
@honeypots
end
|
.sentence_for_humans ⇒ Object
37
38
39
|
# File 'lib/invisible_captcha.rb', line 37
def sentence_for_humans
call_lambda_or_return(@sentence_for_humans)
end
|
.timestamp_error_message ⇒ Object
45
46
47
|
# File 'lib/invisible_captcha.rb', line 45
def timestamp_error_message
call_lambda_or_return(@timestamp_error_message)
end
|
.timestamp_threshold ⇒ Object
Returns the value of attribute timestamp_threshold.
13
14
15
|
# File 'lib/invisible_captcha.rb', line 13
def timestamp_threshold
@timestamp_threshold
end
|
.visual_honeypots ⇒ Object
Returns the value of attribute visual_honeypots.
13
14
15
|
# File 'lib/invisible_captcha.rb', line 13
def visual_honeypots
@visual_honeypots
end
|
Class Method Details
.get_honeypot ⇒ Object
53
54
55
|
# File 'lib/invisible_captcha.rb', line 53
def get_honeypot
honeypots.sample
end
|
.init! ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/invisible_captcha.rb', line 17
def init!
self.sentence_for_humans = -> { I18n.t('invisible_captcha.sentence_for_humans', default: 'If you are a human, ignore this field') }
self.error_message = -> { I18n.t('invisible_captcha.error_message', default: 'You are a robot!') }
self.honeypots = ['foo_id', 'bar_id', 'baz_id']
self.timestamp_threshold = 4
self.timestamp_error_message = -> { I18n.t('invisible_captcha.timestamp_error_message', default: 'Sorry, that was too quick! Please resubmit.') }
self.visual_honeypots = false
end
|
.setup {|_self| ... } ⇒ Object
49
50
51
|
# File 'lib/invisible_captcha.rb', line 49
def setup
yield(self) if block_given?
end
|