wechat-validator 0.3 → 0.3.1

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
  SHA1:
3
- metadata.gz: 5109b3bbb8a3e6360b6111134b4cb85d606c6682
4
- data.tar.gz: ec6a546d8312f57b5ac0f5ef1b6c00b3d590614d
3
+ metadata.gz: 544b1d0748f4dd1814c1000a2f6bba67eb75d395
4
+ data.tar.gz: c29c808358598ca9d7edc6e9062b530a22b50337
5
5
  SHA512:
6
- metadata.gz: 8e46448d4eb99540ceae67e5174fbdc0932d7d6ce9409f143ff5982190aa3435b070442280baab4b33b95ba852c777bfbc2c67586dfe241784aace40887b40a2
7
- data.tar.gz: 6cbbb88bdafbc9aec64b8e73f642e3f93277200a7f1a16dbe866f8e8b2eed1253abb39be15bc4efc5b6cdb6d397c306bdef50e2822ef4dd825c081acaf140bcf
6
+ metadata.gz: 405b0d2eab7d21cf3434b1770ccef44bdfe1c3e950834d198cafd473189a233442dbffe05332070c8f0d46e844f7977c8a3d5368c41374ef2896f49a93a03438
7
+ data.tar.gz: 6a5aa6da41e11bb1f2f7659c9c08949cfa3215ee87bfc594e82541dc1a0ea8e3fe2d71dfe2d30940da5a098f1e51ab6554ea75d4310a470f4566568f024abca7
data/README.md CHANGED
@@ -6,6 +6,10 @@
6
6
  The Wechat Server Validator Engine is an engine which handles the Wechat server validation requests.
7
7
  微信服务器验证引擎是一个处理[微信服务器验证](http://mp.weixin.qq.com/wiki/8/f9a0b8382e0b77d87b3bcc1ce6fbc104.html#.E7.AC.AC.E4.BA.8C.E6.AD.A5.EF.BC.9A.E9.AA.8C.E8.AF.81.E6.9C.8D.E5.8A.A1.E5.99.A8.E5.9C.B0.E5.9D.80.E7.9A.84.E6.9C.89.E6.95.88.E6.80.A7)请求的引擎。
8
8
 
9
+ ## Recent Update
10
+ Check out the [Road Map](ROADMAP.md) to find out what's the next.
11
+ Check out the [Change Log](CHANGELOG.md) to find out what's new.
12
+
9
13
  ## Usage
10
14
  In the application's /config/routes.rb file, add the following line:
11
15
  ```ruby
@@ -10,4 +10,4 @@
10
10
  // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
11
  // about supported directives.
12
12
  //
13
- //= require_tree .
13
+ //= require_self
@@ -10,6 +10,5 @@
10
10
  * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
11
  * file per style scope.
12
12
  *
13
- *= require_tree .
14
13
  *= require_self
15
14
  */
@@ -12,7 +12,7 @@ module Wechat
12
12
 
13
13
  if token.blank?
14
14
  Rails.logger.warn 'Token is required to validate URL by Wechat.'
15
- render status: :forbidden, text: 'The token parameter is required.'
15
+ render status: :bad_request, text: 'The token parameter is required.'
16
16
  return
17
17
  end
18
18
 
@@ -33,7 +33,7 @@ module Wechat
33
33
  if signature_matched
34
34
  render text: echo
35
35
  else
36
- render status: :forbidden, text: "The signature parameter '#{signature}' and the generated parameter '#{actual_signature}' is not matched."
36
+ render status: :bad_request, text: "The signature parameter '#{signature}' and the generated parameter '#{actual_signature}' is not matched."
37
37
  end
38
38
 
39
39
  end
@@ -8,7 +8,7 @@ module Wechat::Validator::Concerns::SignatureValidator
8
8
 
9
9
  if token.blank?
10
10
  Rails.logger.warn 'Token is required to validate URL by Wechat.'
11
- render status: :forbidden, text: 'The token parameter is required.'
11
+ render status: :bad_request, text: 'The token parameter is required.'
12
12
  return
13
13
  end
14
14
 
@@ -22,14 +22,14 @@ module Wechat::Validator::Concerns::SignatureValidator
22
22
  return unless validate_parameter 'signature', signature
23
23
  return unless validate_parameter 'echo', echo
24
24
 
25
- actual_signature = ::Wechat::Validation::Signature.create nonce, timestamp, token # ::Wechat::Validation.sign nonce, timestamp, token
25
+ actual_signature = Wechat::Validation::Signature.create nonce, timestamp, token # ::Wechat::Validation.sign nonce, timestamp, token
26
26
  signature_matched = signature==actual_signature
27
27
  Rails.logger.warn "Actual signature is #{actual_signature}, which #{signature_matched ? 'equals' : 'does not equal'} to the given signature #{signature}."
28
28
 
29
29
  if signature_matched
30
30
  render text: echo
31
31
  else
32
- render status: :forbidden, text: "The signature parameter '#{signature}' and the generated parameter '#{actual_signature}' is not matched."
32
+ render status: :bad_request, text: "The signature parameter '#{signature}' and the generated parameter '#{actual_signature}' is not matched."
33
33
  end
34
34
 
35
35
  end
@@ -3,12 +3,13 @@
3
3
  <head>
4
4
  <title>Validator</title>
5
5
  <%= stylesheet_link_tag "validator/application", media: "all" %>
6
- <%= javascript_include_tag "validator/application" %>
7
6
  <%= csrf_meta_tags %>
8
7
  </head>
9
8
  <body>
10
9
 
11
10
  <%= yield %>
12
11
 
12
+ <%= javascript_include_tag 'wechat/validator/application' %>
13
+
13
14
  </body>
14
15
  </html>
@@ -1,5 +1,5 @@
1
1
  module Wechat
2
2
  module Validator
3
- VERSION = '0.3'.freeze
3
+ VERSION = '0.3.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wechat-validator
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Topbit Du
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-01 00:00:00.000000000 Z
11
+ date: 2016-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: wechat-validation
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.2'
41
41
  description: The Wechat Validator engine handles the Wechat server validation requests.
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  version: '0'
83
83
  requirements: []
84
84
  rubyforge_project:
85
- rubygems_version: 2.4.5.1
85
+ rubygems_version: 2.6.4
86
86
  signing_key:
87
87
  specification_version: 4
88
88
  summary: Wechat Validator Engine 微信验证器引擎