devise_google_authenticator 0.3.9 → 0.3.10
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,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MmFhOTViZTIzZjljNDZkZTBhZTE3YTUyYWZiYWI2MzFiZWE3N2ZiZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MDNkY2FmYTk5NjVkZmM0MDYyYzFkYTY0ZjRjZWVhYzY1NWRjMjVhMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZmJkNDRlNmNiNmNiYmJhOGUwMTMyZWU1NDI1YTUwNzhjMzg0YjA1ODQwOTI1
|
10
|
+
ZGYyNDhkYzQyOGZkYzk4NDUwOTE3MGFmODk4NDc0NTE1Yjg2MGMwMTgxZjBj
|
11
|
+
MTJkZjE0MjcyYjFmOTFkMGVkNzlkODAxNDk5MWVlYjIyMjdiZTU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDdiZjQwMGIyYWE3M2YzNGU5ZDJlNDc2MGE2NzI1Y2ZmNzllYTNmNDgxMWE0
|
14
|
+
N2QxYWU5NWRjYWE4MjVlM2RmMDNlYjRjNDRlNDBlYmYwYTZkN2MxNDVkYmIw
|
15
|
+
YTJkMmVhNmM2ODkxMzgyMmE5ZTE4NWI5MjYxNDU1NTE3MTc4MTc=
|
data/README.rdoc
CHANGED
@@ -15,19 +15,20 @@ This is a devise[https://github.com/plataformatec/devise] extension to allow you
|
|
15
15
|
* Version 0.3.7 - Support for current Devise (3.2.0) and Rails4 (Thanks https://github.com/ronald05arias) - integration test still broke - need to address this
|
16
16
|
* Version 0.3.8 - Support for remembering the token authentication. (i.e. don't request the token for a configurable amount of time Thanks https://github.com/blahblahblah-) - and seriously, I'm going to try and refactor all the integration tests with Rspec.
|
17
17
|
* Version 0.3.9 - Merging fix from zhenyuchen (deprecated ActiveRecord query grammar) - also, re-tested against Rails 4.0.4 and Devise 3.2.3
|
18
|
+
* Version 0.3.10 - Added support for Mongoid ORM in addition to ActiveRecord. (Still no appropriate testing for, but I've run this on vanilla Rails 4.0.4 and Devise 3.2.3 apps)
|
18
19
|
|
19
20
|
== Installation
|
20
21
|
|
21
22
|
Add the gem to your Gemfile (don't forget devise too):
|
22
23
|
|
23
24
|
* gem 'devise'
|
24
|
-
* gem 'devise_google_authenticator', '0.3.
|
25
|
+
* gem 'devise_google_authenticator', '0.3.10'
|
25
26
|
|
26
27
|
Don't forget to "bundle install"
|
27
28
|
|
28
29
|
=== Devise Installation (In case you haven't done it)
|
29
30
|
|
30
|
-
|
31
|
+
Before you can setup Devise Google Authenticator you need to setup Devise first, you need to do the following (but refer to https://github.com/plataformatec/devise for more information)
|
31
32
|
|
32
33
|
Install Devise:
|
33
34
|
* rails g devise:install
|
@@ -51,7 +52,7 @@ After you've created your Devise user models (which is usually done with a "rail
|
|
51
52
|
|
52
53
|
* rails g devise_google_authenticator MODEL
|
53
54
|
|
54
|
-
Don't forget to migrate:
|
55
|
+
Don't forget to migrate if you're NOT using Mongoid as your database ORM, Mongoid installations will have appropriate fields added to the model after the command above:
|
55
56
|
|
56
57
|
* rake db:migrate
|
57
58
|
|
@@ -49,6 +49,20 @@ module Devise # :nodoc:
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
+
def gauth_enabled?
|
53
|
+
# Active_record seems to handle determining the status better this way
|
54
|
+
if self.gauth_enabled.respond_to?("to_i")
|
55
|
+
if self.gauth_enabled.to_i != 0
|
56
|
+
return true
|
57
|
+
else
|
58
|
+
return false
|
59
|
+
end
|
60
|
+
# Mongoid does NOT have a .to_i for the Boolean return value, hence, we can just return it
|
61
|
+
else
|
62
|
+
return self.gauth_enabled
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
52
66
|
def require_token?(cookie)
|
53
67
|
if self.class.ga_remembertime.nil? || cookie.blank?
|
54
68
|
return true
|
@@ -11,7 +11,7 @@ module DeviseGoogleAuthenticator::Patches
|
|
11
11
|
|
12
12
|
resource = warden.authenticate!(:scope => resource_name, :recall => "#{controller_path}#new")
|
13
13
|
|
14
|
-
if resource.respond_to?(:get_qr) and resource.gauth_enabled
|
14
|
+
if resource.respond_to?(:get_qr) and resource.gauth_enabled? and resource.require_token?(cookies.signed[:gauth]) #Therefore we can quiz for a QR
|
15
15
|
tmpid = resource.assign_tmp #assign a temporary key and fetch it
|
16
16
|
warden.logout #log the user out
|
17
17
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rails/generators/named_base'
|
2
|
+
require 'generators/devise/orm_helpers'
|
3
|
+
|
4
|
+
module Mongoid
|
5
|
+
module Generators
|
6
|
+
class DeviseGoogleAuthenticatorGenerator < Rails::Generators::NamedBase
|
7
|
+
include Devise::Generators::OrmHelpers
|
8
|
+
|
9
|
+
def inject_field_types
|
10
|
+
inject_into_file model_path, migration_data, :after => "include Mongoid::Document\n" if model_exists?
|
11
|
+
end
|
12
|
+
|
13
|
+
def migration_data
|
14
|
+
<<RUBY
|
15
|
+
# Google Authenticator
|
16
|
+
field :gauth_secret, :type => String
|
17
|
+
field :gauth_enabled, :type => Boolean, :default => 'f'
|
18
|
+
field :gauth_tmp, :type => String
|
19
|
+
field :gauth_tmp_datetime, :type => DateTime
|
20
|
+
|
21
|
+
RUBY
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_google_authenticator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Frichot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -109,6 +109,7 @@ files:
|
|
109
109
|
- lib/generators/devise_google_authenticator/devise_google_authenticator_generator.rb
|
110
110
|
- lib/generators/devise_google_authenticator/install_generator.rb
|
111
111
|
- lib/generators/devise_google_authenticator/views_generator.rb
|
112
|
+
- lib/generators/mongoid/devise_google_authenticator_generator.rb
|
112
113
|
- LICENSE.txt
|
113
114
|
- README.rdoc
|
114
115
|
homepage: http://github.com/AsteriskLabs/devise_google_authenticator
|