devise_multiple_token_auth 0.0.16 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/devise_multiple_token_auth/device_update_controller.rb +19 -0
- data/config/routes.rb +1 -1
- data/lib/devise_multiple_token_auth/version.rb +1 -1
- data/lib/generators/devise_multiple_token_auth/templates/migrations/create_devise_multiple_token_auth_devices.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72f253368599738a5a38c09e82166e489fddb2a8
|
4
|
+
data.tar.gz: 9124b55ebd5474c53fa829bdbca9e2336edf87eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e526e66210dc2bae2e093e32944a57de17b1b407a79ac736f341a8007dbac5447d0f74f4a36e66f7736103e6ed92443360e6c13c316a25a8bf3e5334c145385e
|
7
|
+
data.tar.gz: 51cf64cc76b570959c339d72a5ebd9741d4053d6812fa467745dc71b129155f2079720330e93bff39a51dcc755d1194bd8c1b4ff0aaf4cf9d7f7e238ca482d22
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class DeviseMultipleTokenAuth::DeviceUpdateController < ApplicationController
|
2
|
+
|
3
|
+
before_filter :authenticate_token_user!
|
4
|
+
|
5
|
+
respond_to :json
|
6
|
+
|
7
|
+
def update_push_token
|
8
|
+
if @device.update(push_token_params)
|
9
|
+
render json: @device
|
10
|
+
else
|
11
|
+
render json: {error: "Unable to update the device with those params"}, status: :unprocessable_entity
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
def push_token_params
|
17
|
+
params.permit(:push_token, :platform)
|
18
|
+
end
|
19
|
+
end
|
data/config/routes.rb
CHANGED
@@ -2,6 +2,6 @@ Rails.application.routes.draw do
|
|
2
2
|
namespace :devise_multiple_token_auth do
|
3
3
|
post "auth/login", to: "token_authentication#login", defaults: { format: 'json'}
|
4
4
|
delete "auth/logout", to: "token_authentication#logout", defaults: { format: 'json'}
|
5
|
-
|
5
|
+
put "update_push_token", to: "device_update_controller#update_push_token", defaults: { format: 'json'}
|
6
6
|
end
|
7
7
|
end
|
@@ -2,7 +2,7 @@ class CreateDeviseMultipleTokenAuthDevices < ActiveRecord::Migration
|
|
2
2
|
def change
|
3
3
|
create_table :devise_multiple_token_auth_devices do |t|
|
4
4
|
t.belongs_to :user, index: true
|
5
|
-
t.string :auth_token
|
5
|
+
t.string :auth_token, null:false, index: {unique: true}
|
6
6
|
t.datetime :expires_at
|
7
7
|
t.timestamps null: false
|
8
8
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Juncker
|
@@ -49,6 +49,7 @@ extra_rdoc_files: []
|
|
49
49
|
files:
|
50
50
|
- MIT-LICENSE
|
51
51
|
- Rakefile
|
52
|
+
- app/controllers/devise_multiple_token_auth/device_update_controller.rb
|
52
53
|
- app/controllers/devise_multiple_token_auth/token_authentication_controller.rb
|
53
54
|
- app/models/devise_multiple_token_auth/device.rb
|
54
55
|
- app/models/devise_multiple_token_auth/device/android.rb
|