captchah 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 502bc3820e62cb7b7fb97545f4c1ac94f171c0b7c9b58c627478532bab9b5ae2
|
4
|
+
data.tar.gz: e9ba6e13b45dfcaeeb878420f81f595c7c811f67ad1e40d752761629e0eef750
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15f715e84f04593beb24ea2f07514cf946b998a4cd45bf92ee81e5fbe1f3b9099928dac0679bda2f48907f6acbf97dfbe952cd99f786aca372055deb5c362e2c
|
7
|
+
data.tar.gz: 828f3acb3534a8c63a994d19b4c85aceb7049404d7ce3f0f0570029231787713c37e02d6bc36cbd7b1fe52d27d5f1f148cf93de8983048b5909863217e788ba2
|
data/README.md
CHANGED
@@ -50,6 +50,12 @@ Add the captchah_tag form helper to your form. Note, only 1 captchah_tag per for
|
|
50
50
|
<%= captchah_tag %>
|
51
51
|
```
|
52
52
|
|
53
|
+
Note, the gem uses the 'Verdana' font to create the puzzle image. If the font is missing from your system, please install it, or specify a different one as the 'puzzle_font' argument shown below. To see what fonts are available to ImageMagick, you can run:
|
54
|
+
|
55
|
+
```
|
56
|
+
$ convert -list font
|
57
|
+
```
|
58
|
+
|
53
59
|
Once a user submits your form, you can verify if they have typed in the correct characters by calling the verify_captchah method inside your controller. Example:
|
54
60
|
|
55
61
|
```
|
@@ -74,7 +80,8 @@ captchah_tag(
|
|
74
80
|
reload_label: 'Reload', # String value Default: 'Reload'
|
75
81
|
reload_max: 5, # Integer value Default: 5
|
76
82
|
reload: true, # Boolean value Default: true
|
77
|
-
css: true
|
83
|
+
css: true, # Boolean value Default: true
|
84
|
+
puzzle_font: 'Verdana' # String value Default: 'Verdana'
|
78
85
|
)
|
79
86
|
```
|
80
87
|
|
@@ -10,6 +10,7 @@ module Captchah
|
|
10
10
|
DEFAULT_RELOAD_LABEL = 'Reload'
|
11
11
|
DEFAULT_RELOAD_MAX = 5
|
12
12
|
DEFAULT_RELOAD_COUNT = 1
|
13
|
+
DEFAULT_PUZZLE_FONT = 'Verdana'
|
13
14
|
|
14
15
|
def self.call(*args)
|
15
16
|
new(*args).send(:call)
|
@@ -26,6 +27,7 @@ module Captchah
|
|
26
27
|
@reload_count = args[:reload_count] || DEFAULT_RELOAD_COUNT
|
27
28
|
@reload = args[:reload] == false ? false : allow_reload?
|
28
29
|
@css = (args[:css] != false)
|
30
|
+
@puzzle_font = args[:puzzle_font] || DEFAULT_PUZZLE_FONT
|
29
31
|
end
|
30
32
|
|
31
33
|
private
|
@@ -40,7 +42,8 @@ module Captchah
|
|
40
42
|
:reload_max,
|
41
43
|
:reload_count,
|
42
44
|
:reload,
|
43
|
-
:css
|
45
|
+
:css,
|
46
|
+
:puzzle_font
|
44
47
|
)
|
45
48
|
|
46
49
|
def call
|
@@ -60,7 +63,7 @@ module Captchah
|
|
60
63
|
end
|
61
64
|
|
62
65
|
def puzzle
|
63
|
-
Puzzle.call(truth, difficulty)
|
66
|
+
Puzzle.call(truth, difficulty, puzzle_font)
|
64
67
|
end
|
65
68
|
|
66
69
|
def truth
|
@@ -84,7 +87,8 @@ module Captchah
|
|
84
87
|
reload_max: reload_max,
|
85
88
|
reload_count: reload_count,
|
86
89
|
reload: reload,
|
87
|
-
css: css
|
90
|
+
css: css,
|
91
|
+
puzzle_font: puzzle_font
|
88
92
|
)
|
89
93
|
end
|
90
94
|
|
@@ -7,11 +7,10 @@ module Captchah
|
|
7
7
|
new(*args).send(:call)
|
8
8
|
end
|
9
9
|
|
10
|
-
def initialize(truth, difficulty)
|
10
|
+
def initialize(truth, difficulty, font)
|
11
11
|
@truth = truth
|
12
12
|
@difficulty = difficulty
|
13
|
-
|
14
|
-
@font = 'Verdana'
|
13
|
+
@font = font
|
15
14
|
@color1 = '44,44,44'
|
16
15
|
@color2 = '235,235,235'
|
17
16
|
end
|
data/lib/captchah/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: captchah
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evgeni Radev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mini_magick
|