agilib 0.1.6 → 0.1.7

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
  SHA1:
3
- metadata.gz: 189bdf1f51474c316ab63deca338df69327b94e6
4
- data.tar.gz: d3e671ce9629dd9785f46189d632dc4c99ccfaca
3
+ metadata.gz: 7a02f38c6455b68e441786611c3517e57f1f2728
4
+ data.tar.gz: af96f96e3fb27a279a9d4a9a9d525bf250e5cc3b
5
5
  SHA512:
6
- metadata.gz: 759fd4250a1f4f45acd1d1da2173b35a444ed028a49027a085db5b826dec88a25709a4b745f844c135749867cbd07fc53bdf396452ca0bfe0b2761202a34b0d5
7
- data.tar.gz: 719ed059848d95ce980ea54e8e70600f6909d0b428e70890ab0ceaaa5c88e2a7c2f99fd11caa8a68faa84df6ec68bce80cc3d1bbcb13457399302d6dbdff3b93
6
+ metadata.gz: d2fb50bd99e0161ed38234329b2f2be61b92a272f405f9c65d441fbedef74f27439560d8238fc25aa7c757c8903b58764f64eb244679fa1e9ed725608b53adf2
7
+ data.tar.gz: 2672e7113bb0119f2bf289e381d31ab34c751e0f039b8a59c69c570fac2ba6fb589d6b8103800cdb656aa807def31ea69f57774d4dd13d77c663761411dc2808
@@ -66,5 +66,23 @@ module Agilib
66
66
  end
67
67
  end
68
68
 
69
+ # GET /tokens/1/check.json
70
+ def check
71
+ token = params[Agilib::TokenAuthenticatable.auth_params[:user_token]]
72
+
73
+ if User.respond_to? "find_by"
74
+ @user = User.find_by(authentication_token: token)
75
+ elsif User.respond_to? "find_by_authentication_token"
76
+ @user = User.find_by_authentication_token(token)
77
+ end
78
+
79
+ if @user.nil?
80
+ render :status=>404, :json=>{:message=>t('agilib.token_authenticatable.invalid_token', :default => "Invalid Token")}
81
+ return
82
+ else
83
+ render :status=>200, :json=>{:user=> @user, :token => @user.authentication_token}
84
+ end
85
+ end
86
+
69
87
  end
70
88
  end
@@ -21,8 +21,9 @@ module Agilib
21
21
  def agilib_token_authenticatable
22
22
  route = Agilib::TokenAuthenticatable.route
23
23
  devise_scope :user do
24
- post "#{route}" => "agilib/tokens#create"
25
- delete "#{route}" => "agilib/tokens#destroy"
24
+ post "#{route}" => "agilib/tokens#create"
25
+ delete "#{route}" => "agilib/tokens#destroy"
26
+ get "#{route}/check" => "agilib/tokens#check"
26
27
  end
27
28
  end
28
29
 
@@ -2,7 +2,7 @@ module Agilib
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 6
5
+ PATCH = 7
6
6
  BUILD = ''
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: agilib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcos Junior