devise_multiple_token_auth 0.0.22 → 0.0.23
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b00f815325a2452000637f782bcca9703626fae
|
4
|
+
data.tar.gz: 420c1c6e8e8f284947f7d2ce76c704557f52402f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54cbb3c6e9ddbdd97e8246d8fd55e049226676ac7966bf9e843febbc6094a6fdbcc12e6c4ea4a26636020130556ba33aab4660f8298e653d598c2b0ed4b72dcb
|
7
|
+
data.tar.gz: 5656f0f6360459bd24c58326119b6049b41c2f39325f76ebf2708fc364a57173ecd1581781bf9c5b4a9de34be689dadecd5d1db9369f98916899614648135a13
|
@@ -6,7 +6,7 @@ class DeviseMultipleTokenAuth::DeviceUpdateController < ApplicationController
|
|
6
6
|
|
7
7
|
def update_push_token
|
8
8
|
if @device.update(push_token_params)
|
9
|
-
|
9
|
+
@device.cleanup_push_tokens!
|
10
10
|
render json: @device
|
11
11
|
else
|
12
12
|
render json: {error: "Unable to update the device with those params"}, status: :unprocessable_entity
|
@@ -8,8 +8,8 @@ class DeviseMultipleTokenAuth::Device < ActiveRecord::Base
|
|
8
8
|
DeviseMultipleTokenAuth::Device.expired.destroy_all
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
12
|
-
|
11
|
+
def cleanup_push_tokens!
|
12
|
+
self.class.where.not(id:self.id).where(push_token:self.push_token).each do |other_device|
|
13
13
|
other_device.push_token = nil
|
14
14
|
other_device.save
|
15
15
|
end
|