two_factor_authentication 1.1 → 1.1.1
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 +4 -4
- data/.travis.yml +1 -0
- data/README.md +1 -0
- data/app/controllers/devise/two_factor_authentication_controller.rb +1 -1
- data/lib/two_factor_authentication/controllers/helpers.rb +2 -2
- data/lib/two_factor_authentication/hooks/two_factor_authenticatable.rb +1 -1
- data/lib/two_factor_authentication/models/two_factor_authenticatable.rb +1 -1
- data/lib/two_factor_authentication/version.rb +1 -1
- data/spec/lib/two_factor_authentication/models/two_factor_authenticatable_spec.rb +9 -1
- data/spec/rails_app/config/initializers/cookies_serializer.rb +3 -0
- data/two_factor_authentication.gemspec +1 -0
- metadata +19 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8037c367e1a0f7f7d253be0457b2046488b628fa
|
4
|
+
data.tar.gz: 024269293da1e0a407ac4e3537dc4e8749ca95a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c5a7deda98812e0a46ced0f99f2c0af64d4cd57531aad76660fecc7a1b351ba776263b24066a3d1f8caa93279f97fba1d415bcf41caf13bb1bc627a3a0c49ba
|
7
|
+
data.tar.gz: 2c80f6553ff57dbc3257f20c345cdf2217eefcf7d543f7547c0c31f8e57dbfc94ccf27759acbf81ba3937b05a808a8cc42acbb3ce7ee1ee7cb4869379f02bbaf
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Two factor authentication for Devise
|
2
2
|
|
3
3
|
[](https://travis-ci.org/Houdini/two_factor_authentication)
|
4
|
+
[](https://codeclimate.com/github/Houdini/two_factor_authentication)
|
4
5
|
|
5
6
|
## Features
|
6
7
|
|
@@ -9,7 +9,7 @@ class Devise::TwoFactorAuthenticationController < DeviseController
|
|
9
9
|
render :show and return if params[:code].nil?
|
10
10
|
|
11
11
|
if resource.authenticate_otp(params[:code])
|
12
|
-
warden.session(resource_name)[
|
12
|
+
warden.session(resource_name)['need_two_factor_authentication'] = false
|
13
13
|
sign_in resource_name, resource, :bypass => true
|
14
14
|
set_flash_message :notice, :success
|
15
15
|
redirect_to stored_location_for(resource_name) || :root
|
@@ -12,7 +12,7 @@ module TwoFactorAuthentication
|
|
12
12
|
def handle_two_factor_authentication
|
13
13
|
unless devise_controller?
|
14
14
|
Devise.mappings.keys.flatten.any? do |scope|
|
15
|
-
if signed_in?(scope) and warden.session(scope)[
|
15
|
+
if signed_in?(scope) and warden.session(scope)['need_two_factor_authentication']
|
16
16
|
handle_failed_second_factor(scope)
|
17
17
|
end
|
18
18
|
end
|
@@ -42,7 +42,7 @@ module Devise
|
|
42
42
|
module Controllers
|
43
43
|
module Helpers
|
44
44
|
def is_fully_authenticated?
|
45
|
-
!session["warden.user.user.session"].try(:[],
|
45
|
+
!session["warden.user.user.session"].try(:[], 'need_two_factor_authentication')
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Warden::Manager.after_authentication do |user, auth, options|
|
2
2
|
if user.respond_to?(:need_two_factor_authentication?)
|
3
|
-
if auth.session(options[:scope])[
|
3
|
+
if auth.session(options[:scope])['need_two_factor_authentication'] = user.need_two_factor_authentication?(auth.request)
|
4
4
|
user.send_two_factor_authentication_code
|
5
5
|
end
|
6
6
|
end
|
@@ -25,7 +25,15 @@ describe Devise::Models::TwoFactorAuthenticatable, '#otp_code' do
|
|
25
25
|
let(:time) { 1392852756 }
|
26
26
|
|
27
27
|
it "should return a known result" do
|
28
|
-
expect(subject).to eq(562202)
|
28
|
+
expect(subject).to eq('562202')
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "with a known time yielding a result with less than 6 digits" do
|
33
|
+
let(:time) { 1393065856 }
|
34
|
+
|
35
|
+
it "should return a known result padded with zeroes" do
|
36
|
+
expect(subject).to eq('007672')
|
29
37
|
end
|
30
38
|
end
|
31
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: two_factor_authentication
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitrii Golub
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - '>='
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: pry
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
125
139
|
description: |2
|
126
140
|
### Features ###
|
127
141
|
* control sms code pattern
|
@@ -184,6 +198,7 @@ files:
|
|
184
198
|
- spec/rails_app/config/environments/production.rb
|
185
199
|
- spec/rails_app/config/environments/test.rb
|
186
200
|
- spec/rails_app/config/initializers/backtrace_silencers.rb
|
201
|
+
- spec/rails_app/config/initializers/cookies_serializer.rb
|
187
202
|
- spec/rails_app/config/initializers/devise.rb
|
188
203
|
- spec/rails_app/config/initializers/inflections.rb
|
189
204
|
- spec/rails_app/config/initializers/mime_types.rb
|
@@ -229,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
229
244
|
version: '0'
|
230
245
|
requirements: []
|
231
246
|
rubyforge_project: two_factor_authentication
|
232
|
-
rubygems_version: 2.
|
247
|
+
rubygems_version: 2.2.2
|
233
248
|
signing_key:
|
234
249
|
specification_version: 4
|
235
250
|
summary: Two factor authentication plugin for devise
|
@@ -261,6 +276,7 @@ test_files:
|
|
261
276
|
- spec/rails_app/config/environments/production.rb
|
262
277
|
- spec/rails_app/config/environments/test.rb
|
263
278
|
- spec/rails_app/config/initializers/backtrace_silencers.rb
|
279
|
+
- spec/rails_app/config/initializers/cookies_serializer.rb
|
264
280
|
- spec/rails_app/config/initializers/devise.rb
|
265
281
|
- spec/rails_app/config/initializers/inflections.rb
|
266
282
|
- spec/rails_app/config/initializers/mime_types.rb
|