devise_multiple_token_auth 0.0.21 → 0.0.22
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfdf2a4fdf2ea88294f52253a4575782f98e9d5b
|
4
|
+
data.tar.gz: b663dfa01618f3d864474359c71bfe1dea1921d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe177160078b141e20be91242e16c03dbfc7f067e9c1dfebbfb692d17dbc9d65e12a40aa880bcc7d2f8f702c34f867cdb7b71a2607879b868fe3ddd9862f4fa7
|
7
|
+
data.tar.gz: 1acef4022584fea7fdb1dbcdf44a55c7e77fff7e30add74c37ebcb89fe2895cb9a20f407e0bbbb963c60360a53448a1978a949eaeb88212161fd924202ec1ec3
|
@@ -1,11 +1,12 @@
|
|
1
1
|
class DeviseMultipleTokenAuth::DeviceUpdateController < ApplicationController
|
2
|
-
|
2
|
+
|
3
3
|
before_filter :authenticate_token_user!
|
4
4
|
|
5
5
|
respond_to :json
|
6
6
|
|
7
7
|
def update_push_token
|
8
8
|
if @device.update(push_token_params)
|
9
|
+
DeviseMultipleTokenAuth::Device.cleanup_push_tokens(@device.push_token, @device)
|
9
10
|
render json: @device
|
10
11
|
else
|
11
12
|
render json: {error: "Unable to update the device with those params"}, status: :unprocessable_entity
|
@@ -16,4 +17,4 @@ class DeviseMultipleTokenAuth::DeviceUpdateController < ApplicationController
|
|
16
17
|
def push_token_params
|
17
18
|
params.permit(:push_token, :platform)
|
18
19
|
end
|
19
|
-
end
|
20
|
+
end
|
@@ -7,9 +7,15 @@ class DeviseMultipleTokenAuth::Device < ActiveRecord::Base
|
|
7
7
|
def self.destroy_expired
|
8
8
|
DeviseMultipleTokenAuth::Device.expired.destroy_all
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
|
+
def self.cleanup_push_tokens!(token,omit_device)
|
12
|
+
Device.where.not(id:omit_device.id).where(push_token:token).each do |other_device|
|
13
|
+
other_device.push_token = nil
|
14
|
+
other_device.save
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
11
18
|
def expired?
|
12
19
|
expires_at < Time.now
|
13
20
|
end
|
14
21
|
end
|
15
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_multiple_token_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Juncker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 3.5.2
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: slim
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
description: If you like to use Devise, but wish it had an easy token authentication
|
42
56
|
system that handles a user logging in from multiple devices, DeviseMultipleTokenAuth
|
43
57
|
is for you.
|