glebtv-simple_captcha 0.7.0 → 0.8.0
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
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 653ac01fb6ddf71a0e4eceea878986e35de35b4e67fc65951e8d3ef8b38e712b
|
4
|
+
data.tar.gz: 82b3121008ea69c1bbf490da5381945999fcda04904b3fdcbb50eaa45101d284
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29befa7e753674306bff80506f6ce57f94048c1a1b94b55d4ccdc175852c41657b9ee654245357e02c3bbe57d105b584664830ec48e4e07b9e2ee6d31a3d1569
|
7
|
+
data.tar.gz: 0a92dd62e37a82bb749a75d34e48564d2538ef4b16d431f6e2315978f4bf7470b81ac335fc3d16382ceb9f5db347e74a7a7f7221d93df4b31735fd1c4e7f1038
|
@@ -8,14 +8,14 @@ module SimpleCaptcha
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def remove_data(key)
|
11
|
-
|
11
|
+
where("#{connection.quote_column_name(:key)} = ?", key).delete_all
|
12
12
|
clear_old_data(1.hour.ago)
|
13
13
|
end
|
14
14
|
|
15
15
|
def clear_old_data(time = 1.hour.ago)
|
16
16
|
return unless Time === time
|
17
|
-
|
17
|
+
where("#{connection.quote_column_name(:updated_at)} < ?", time).delete_all
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
21
|
-
end
|
21
|
+
end
|
@@ -2,22 +2,22 @@ module SimpleCaptcha
|
|
2
2
|
class SimpleCaptchaData
|
3
3
|
include Mongoid::Document
|
4
4
|
include Mongoid::Timestamps
|
5
|
-
|
5
|
+
|
6
6
|
store_in collection: "simple_captcha_data"
|
7
|
-
|
7
|
+
|
8
8
|
field :key, :type => String
|
9
9
|
field :value, :type => String
|
10
|
-
|
10
|
+
|
11
11
|
class << self
|
12
12
|
def get_data(key)
|
13
13
|
SimpleCaptchaData.where(:key => key).first || new(:key => key)
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def remove_data(key)
|
17
17
|
SimpleCaptchaData.where(:key => key).first.delete
|
18
18
|
clear_old_data(1.hour.ago)
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def clear_old_data(time = 1.hour.ago)
|
22
22
|
return unless Time === time
|
23
23
|
SimpleCaptchaData.where(:updated_at.lt => time.utc).delete_all
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glebtv-simple_captcha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GlebTv
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
version: '0'
|
100
100
|
requirements: []
|
101
101
|
rubyforge_project:
|
102
|
-
rubygems_version: 2.
|
102
|
+
rubygems_version: 2.7.7
|
103
103
|
signing_key:
|
104
104
|
specification_version: 4
|
105
105
|
summary: A fork of a fork of a fork of simple_captcha.
|