captchah 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ad66eace82032f4bd0032a0a418dc3d110c5d90ae28ae72e7433eec12bb891bb
4
- data.tar.gz: 5916bf46a222fce1aa04f069e4cab99ee2a2276cb4a5a9c179dd2eb385e27ab4
3
+ metadata.gz: 502bc3820e62cb7b7fb97545f4c1ac94f171c0b7c9b58c627478532bab9b5ae2
4
+ data.tar.gz: e9ba6e13b45dfcaeeb878420f81f595c7c811f67ad1e40d752761629e0eef750
5
5
  SHA512:
6
- metadata.gz: 27ff37ca4328a81c6d7477ca54223c45cd4c1cd6cb25512c9b9d8648947113dfb8586208ddcc2bb3e7d5febbf41229ba7c88054e7720e7915b71bd2f9b0bec04
7
- data.tar.gz: 2429ba66d17e070f54b1a057e8b007c9e7ac08a6f80f3a7dc6869c1c6b757fcb11a82ae38265346ae87809d6a1842440a03ec8fec1fa4bbaa80acebe0204808e
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 # Boolean value Default: true
83
+ css: true, # Boolean value Default: true
84
+ puzzle_font: 'Verdana' # String value Default: 'Verdana'
78
85
  )
79
86
  ```
80
87
 
@@ -36,7 +36,8 @@ module Captchah
36
36
  reload_max: payload[:reload_max],
37
37
  reload_count: payload[:reload_count] + 1,
38
38
  reload: payload[:reload],
39
- css: payload[:css]
39
+ css: payload[:css],
40
+ puzzle_font: payload[:puzzle_font]
40
41
  }
41
42
  end
42
43
 
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Captchah
4
- VERSION = '1.0.5'
4
+ VERSION = '1.0.6'
5
5
  end
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.5
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-23 00:00:00.000000000 Z
11
+ date: 2019-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mini_magick