signinable 2.0.1 → 2.0.2

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: cf9b5cc11f0fb916e6e3eb388c220decaf7fcef3
4
- data.tar.gz: fceb33e6b95321d2a92bcd1470ce0ee6cec98804
3
+ metadata.gz: 3d8325bf916e92dc6a85dee3d346c0538f3aa380
4
+ data.tar.gz: 1739fe9e7b699bab8ff51ab3b747fda9cbc65262
5
5
  SHA512:
6
- metadata.gz: 1f0e5fb24ae7880c95bb9159bba37d4a0ffa293a80f84b08441e0e04ac25ffdf681f0c1999d66dd9e0982966f19f61d50d750ff411505672dac5faa7f695e78c
7
- data.tar.gz: be950872806c55956e47b7572a2eaa5279922e2ca2c4d1804ee7f183ac3c97c4b07d1d70d7b95262a092648732a6035f9bc2bb8fed87f855d7f5943171e6e440
6
+ metadata.gz: 2a95ab6cc9bad781f8b5eae2b81832b13c932d5074985404987262c7947a8119f720695533bfb1cdace0baeb35ec8a8156d48bfc231426e6231f9e19bac95db3
7
+ data.tar.gz: 93e2a5f0cb30aa271ad28291d9841fd63e91fc034d3ff4c04979ea295dd1f4d096101ca0dc3d9f1b4fbf8915073628fa70740b51ab1cfa55f693f409cc3048a0
@@ -16,6 +16,10 @@ module Signinable
16
16
 
17
17
  def authenticate_with_token(token, ip, user_agent)
18
18
  if(signin = Signin.find_by_token(token))
19
+ if self.signin_expiration.respond_to?(:call)
20
+ self.signin_expiration = self.signin_expiration.call(signin.signinable)
21
+ end
22
+
19
23
  if self.signin_expiration > 0
20
24
  return nil if signin.expired?
21
25
  end
@@ -1,3 +1,3 @@
1
1
  module Signinable
2
- VERSION = "2.0.1"
2
+ VERSION = "2.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: signinable
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Novozhenets
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-10 00:00:00.000000000 Z
11
+ date: 2017-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -122,9 +122,6 @@ files:
122
122
  - spec/dummy/config/routes.rb
123
123
  - spec/dummy/db/migrate/20140103165606_create_users.rb
124
124
  - spec/dummy/db/schema.rb
125
- - spec/dummy/db/test.sqlite3
126
- - spec/dummy/log/development.log
127
- - spec/dummy/log/test.log
128
125
  - spec/dummy/public/404.html
129
126
  - spec/dummy/public/422.html
130
127
  - spec/dummy/public/500.html
@@ -154,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
151
  version: '0'
155
152
  requirements: []
156
153
  rubyforge_project:
157
- rubygems_version: 2.2.0
154
+ rubygems_version: 2.4.8
158
155
  signing_key:
159
156
  specification_version: 4
160
157
  summary: Token based signin
@@ -182,9 +179,6 @@ test_files:
182
179
  - spec/dummy/config.ru
183
180
  - spec/dummy/db/migrate/20140103165606_create_users.rb
184
181
  - spec/dummy/db/schema.rb
185
- - spec/dummy/db/test.sqlite3
186
- - spec/dummy/log/development.log
187
- - spec/dummy/log/test.log
188
182
  - spec/dummy/public/404.html
189
183
  - spec/dummy/public/422.html
190
184
  - spec/dummy/public/500.html
Binary file
@@ -1,137 +0,0 @@
1
-  (1.1ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255)) 
2
-  (1.9ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255)) 
3
-  (1.3ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255)) 
4
-  (1.9ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255)) 
5
-  (2.0ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255)) 
6
-  (2.3ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255)) 
7
-  (1.3ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255)) 
8
-  (0.8ms) CREATE TABLE "signins" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "signinable_id" integer NOT NULL, "signinable_type" varchar(255) NOT NULL, "token" varchar(255) NOT NULL, "referer" varchar(255) DEFAULT '', "user_agent" varchar(255) DEFAULT '', "ip" varchar(255) NOT NULL, "expiration_time" datetime, "created_at" datetime, "updated_at" datetime)
9
-  (0.8ms) CREATE INDEX "index_signins_on_signinable_id_and_signinable_type" ON "signins" ("signinable_id", "signinable_type")
10
-  (0.9ms) CREATE INDEX "index_signins_on_token" ON "signins" ("token")
11
-  (2.4ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255)) 
12
-  (1.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
13
-  (0.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
14
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
15
-  (1.6ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
16
-  (0.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
17
-  (0.1ms) SELECT version FROM "schema_migrations"
18
-  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
19
-  (1.6ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
20
-  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
21
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
22
-  (0.9ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
23
-  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
24
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
25
-  (2.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
26
-  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
27
-  (0.1ms) SELECT version FROM "schema_migrations"
28
-  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
29
-  (1.6ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
30
-  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
31
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
32
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
33
-  (0.1ms) SELECT version FROM schema_migrations
34
-  (2.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
35
-  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
36
-  (0.1ms) SELECT version FROM "schema_migrations"
37
-  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
38
-  (1.5ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
39
-  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
40
-  (0.1ms) SELECT version FROM "schema_migrations"
41
-  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
42
-  (2.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
43
-  (0.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
44
-  (0.1ms) SELECT version FROM "schema_migrations"
45
-  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
46
-  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
47
-  (0.6ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
48
-  (0.1ms) SELECT version FROM "schema_migrations"
49
-  (0.6ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
50
-  (1.5ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
51
-  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
52
-  (0.1ms) SELECT version FROM "schema_migrations"
53
-  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
54
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
55
-  (0.1ms) SELECT version FROM schema_migrations
56
-  (0.1ms) SELECT version FROM schema_migrations
57
-  (1.9ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
58
-  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
59
-  (0.1ms) SELECT version FROM "schema_migrations"
60
-  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
61
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
62
- Migrating to CreateUsers (20140103165606)
63
-  (0.1ms) begin transaction
64
-  (0.4ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255)) 
65
- SQL (1.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140103165606"]]
66
-  (1.4ms) commit transaction
67
- Migrating to CreateSignins (20140103165607)
68
-  (0.1ms) begin transaction
69
-  (0.3ms) CREATE TABLE "signins" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "signinable_id" integer NOT NULL, "signinable_type" varchar(255) NOT NULL, "token" varchar(255) NOT NULL, "referer" varchar(255) DEFAULT '', "user_agent" varchar(255) DEFAULT '', "ip" varchar(255) NOT NULL, "expiration_time" datetime, "created_at" datetime, "updated_at" datetime) 
70
-  (0.1ms) CREATE INDEX "index_signins_on_signinable_id_and_signinable_type" ON "signins" ("signinable_id", "signinable_type")
71
-  (0.1ms) CREATE INDEX "index_signins_on_token" ON "signins" ("token")
72
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140103165607"]]
73
-  (0.7ms) commit transaction
74
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
75
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
76
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
77
-  (2.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
78
-  (0.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
79
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
80
- Migrating to CreateUsers (20140103165606)
81
-  (0.1ms) begin transaction
82
-  (0.3ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255)) 
83
- SQL (1.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140103165606"]]
84
-  (0.6ms) commit transaction
85
- Migrating to CreateSignins (20140103165607)
86
-  (0.1ms) begin transaction
87
-  (0.3ms) CREATE TABLE "signins" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "signinable_id" integer NOT NULL, "signinable_type" varchar(255) NOT NULL, "token" varchar(255) NOT NULL, "referer" varchar(255) DEFAULT '', "user_agent" varchar(255) DEFAULT '', "ip" varchar(255) NOT NULL, "expiration_time" datetime, "created_at" datetime, "updated_at" datetime) 
88
-  (0.1ms) CREATE INDEX "index_signins_on_signinable_id_and_signinable_type" ON "signins" ("signinable_id", "signinable_type")
89
-  (0.1ms) CREATE INDEX "index_signins_on_token" ON "signins" ("token")
90
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140103165607"]]
91
-  (0.7ms) commit transaction
92
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
93
-  (2.2ms) CREATE TABLE "signins" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "signinable_id" integer NOT NULL, "signinable_type" varchar(255) NOT NULL, "token" varchar(255) NOT NULL, "referer" varchar(255) DEFAULT '', "user_agent" varchar(255) DEFAULT '', "ip" varchar(255) NOT NULL, "expiration_time" datetime, "created_at" datetime, "updated_at" datetime) 
94
-  (0.8ms) CREATE INDEX "index_signins_on_signinable_id_and_signinable_type" ON "signins" ("signinable_id", "signinable_type")
95
-  (0.9ms) CREATE INDEX "index_signins_on_token" ON "signins" ("token")
96
-  (0.5ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
97
-  (0.9ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
98
-  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
99
-  (0.1ms) SELECT version FROM "schema_migrations"
100
-  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20140103165607')
101
-  (0.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20140103165606')
102
-  (2.2ms) CREATE TABLE "signins" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "signinable_id" integer NOT NULL, "signinable_type" varchar(255) NOT NULL, "token" varchar(255) NOT NULL, "referer" varchar(255) DEFAULT '', "user_agent" varchar(255) DEFAULT '', "ip" varchar(255) NOT NULL, "expiration_time" datetime, "created_at" datetime, "updated_at" datetime) 
103
-  (0.8ms) CREATE INDEX "index_signins_on_signinable_id_and_signinable_type" ON "signins" ("signinable_id", "signinable_type")
104
-  (0.5ms) CREATE INDEX "index_signins_on_token" ON "signins" ("token")
105
-  (0.9ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
106
-  (0.8ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
107
-  (0.6ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
108
-  (0.1ms) SELECT version FROM "schema_migrations"
109
-  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140103165607')
110
-  (0.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20140103165606')
111
-  (1.8ms) CREATE TABLE "signins" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "signinable_id" integer NOT NULL, "signinable_type" varchar(255) NOT NULL, "token" varchar(255) NOT NULL, "referer" varchar(255) DEFAULT '', "user_agent" varchar(255) DEFAULT '', "ip" varchar(255) NOT NULL, "expiration_time" datetime, "created_at" datetime, "updated_at" datetime) 
112
-  (0.7ms) CREATE INDEX "index_signins_on_signinable_id_and_signinable_type" ON "signins" ("signinable_id", "signinable_type")
113
-  (0.6ms) CREATE INDEX "index_signins_on_token" ON "signins" ("token")
114
-  (0.5ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
115
-  (0.6ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
116
-  (0.5ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
117
-  (0.1ms) SELECT version FROM "schema_migrations"
118
-  (0.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20140103165607')
119
-  (0.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20140103165606')
120
-  (0.9ms) CREATE TABLE "signins" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "signinable_id" integer NOT NULL, "signinable_type" varchar(255) NOT NULL, "token" varchar(255) NOT NULL, "referer" varchar(255) DEFAULT '', "user_agent" varchar(255) DEFAULT '', "ip" varchar(255) NOT NULL, "expiration_time" datetime, "created_at" datetime, "updated_at" datetime) 
121
-  (0.7ms) CREATE INDEX "index_signins_on_signinable_id_and_signinable_type" ON "signins" ("signinable_id", "signinable_type")
122
-  (0.6ms) CREATE INDEX "index_signins_on_token" ON "signins" ("token")
123
-  (0.7ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
124
-  (0.6ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
125
-  (0.6ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
126
-  (0.1ms) SELECT version FROM "schema_migrations"
127
-  (0.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20140103165607')
128
-  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20140103165606')
129
-  (1.0ms) CREATE TABLE "signins" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "signinable_id" integer NOT NULL, "signinable_type" varchar(255) NOT NULL, "token" varchar(255) NOT NULL, "referer" varchar(255) DEFAULT '', "user_agent" varchar(255) DEFAULT '', "ip" varchar(255) NOT NULL, "expiration_time" datetime, "created_at" datetime, "updated_at" datetime) 
130
-  (0.9ms) CREATE INDEX "index_signins_on_signinable_id_and_signinable_type" ON "signins" ("signinable_id", "signinable_type")
131
-  (0.8ms) CREATE INDEX "index_signins_on_token" ON "signins" ("token")
132
-  (0.6ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
133
-  (0.8ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
134
-  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
135
-  (0.1ms) SELECT version FROM "schema_migrations"
136
-  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20140103165607')
137
-  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20140103165606')