devise_gauth 0.4.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9a3c30a2e628f5e3fe99a0c4dedaf30f0dcbeced3c6a52a199fa150dd393b4b
4
- data.tar.gz: 3259e009ed15a53e1e154451ad95963e862726f10f3966d46a9f910dfab80fa8
3
+ metadata.gz: '09b671c8a55803aa5c92dbda5af4f77b4d31c5ecdb9d451253b72cc6fd234242'
4
+ data.tar.gz: 923c99b71ed51c6afde9cb34576b11ee9e3ddd71d11f8a7fec2503753ad1df14
5
5
  SHA512:
6
- metadata.gz: bc4bacfe402e8e98667326ec1c73cca6f2c05c545a7e5b450dc3c50d917ef90565aeb1942de381addd3782f83747d324f796148800f1770bc537f2b6af84ce82
7
- data.tar.gz: aba6c26a7a3e7d667425a9aac361ae1a1dd7e60e76600f6b2ebc55f58fd904f98a654caa80528382d507305eae4cf54775bf210361d7e35654f3c719c0a5539d
6
+ metadata.gz: 6847e8fe06172c5ab891a9a0949dff9278dd836df99144e1b09304da58f09eff85c0e5ee32801bfccaa7f07a03104872dfa36c463b2f876aa87ad93778f885b6
7
+ data.tar.gz: e68129afb02bd464b14628dfc7129b77871801c5fef8a310ee491703a77ac84a674dd4c726f0c737d20c5bbb2c36a6578b9c98a657f227fa9905334b112842da
data/README.md CHANGED
@@ -2,14 +2,17 @@
2
2
 
3
3
  This is a fork of the [devise](https://github.com/plataformatec/devise) extension to allow your app to utilise [Google Authenticator](http://code.google.com/p/google-authenticator/) for Time-based One Time Passwords (TOTP).
4
4
 
5
- The current version of this gem support Rails 4.x, 5.x and 6.x.
5
+ The current version of this gem support Rails from version 4.2 (older versions
6
+ are requiring older version of Ruby, which is hard to maintain), until version
7
+ 6.1.x.\
8
+ For more details see the `.github/workflows/ci.yml` file.
6
9
 
7
10
  ## Installation
8
11
 
9
12
  Add the gem to your Gemfile (don't forget devise too):
10
13
 
11
14
  ```ruby
12
- gem 'devise_gauth', '0.3.16'
15
+ gem 'devise_gauth', '0.4.1'
13
16
  ```
14
17
 
15
18
  Don't forget to "bundle install"
@@ -109,6 +112,7 @@ And in the case you'd like to test a different version of Ruby/Rails/Devise:
109
112
  ```
110
113
  earthly --allow-privileged +test --EARTHLY_RUBY_VERSION=2.5 --EARTHLY_RAILS_VERSION=5.2.8.1 --EARTHLY_DEVISE_VERSION=4.8.1
111
114
  ```
115
+ _Be careful when switching between Rails versions, don't forget to delete your local Gemfile.lock file in order to avoid gem issues._
112
116
 
113
117
  ## Thanks (and unknown contributors)
114
118
 
@@ -1,7 +1,7 @@
1
- <h2><%= I18n.t('submit_token_title', { scope: 'devise' }) %></h2>
1
+ <h2><%= I18n.t('submit_token_title', scope: 'devise') %></h2>
2
2
 
3
3
  <%= form_for(resource, as: resource_name, url: [resource_name, :checkga], html: { method: :put }) do |f| %>
4
- <%= f.hidden_field :tmpid, { value: @tmpid } %>
4
+ <%= f.hidden_field :tmpid, value: @tmpid %>
5
5
  <%= f.text_field :gauth_token, autocomplete: :off%>
6
- <p><%= f.submit I18n.t('submit_token', { scope: 'devise' }) %></p>
6
+ <p><%= f.submit I18n.t('submit_token', scope: 'devise') %></p>
7
7
  <% end %>
@@ -1,20 +1,20 @@
1
- <h2><%= I18n.t('title', { scope: 'devise.registration' }) %></h2>
1
+ <h2><%= I18n.t('title', scope: 'devise.registration') %></h2>
2
2
 
3
3
  <%= google_authenticator_qrcode(resource) %>
4
4
 
5
5
  <%= form_for(resource, as: resource_name, url: [:refresh, resource_name, :displayqr], html: { method: :post }) do |f|%>
6
- <p><%= f.submit I18n.t('newtoken', { scope: 'devise.registration' }) %></p>
6
+ <p><%= f.submit I18n.t('newtoken', scope: 'devise.registration') %></p>
7
7
  <% end %>
8
8
 
9
9
  <%= form_for(resource, as: resource_name, url: [resource_name, :displayqr], html: { method: :put }) do |f| %>
10
10
  <%= devise_error_messages! %>
11
- <h3><%= I18n.t('nice_request', { scope: 'devise.registration' }) %></h3>
12
- <p><%= f.label :gauth_enabled, I18n.t('qrstatus', { scope: 'devise.registration' }) %><br />
11
+ <h3><%= I18n.t('nice_request', scope: 'devise.registration') %></h3>
12
+ <p><%= f.label :gauth_enabled, I18n.t('qrstatus', scope: 'devise.registration') %><br />
13
13
  <%= f.check_box :gauth_enabled %></p>
14
14
  <%= f.hidden_field :tmpid, value: @tmpid %>
15
- <p><%= f.label :gauth_token, I18n.t('enter_token', { scope: 'devise.registration' }) %><br />
15
+ <p><%= f.label :gauth_token, I18n.t('enter_token', scope: 'devise.registration') %><br />
16
16
  <%= f.number_field :gauth_token, autocomplete: :off %>
17
17
 
18
- <p><%= f.submit I18n.t('submit', { scope: 'devise.registration' }) %></p>
18
+ <p><%= f.submit I18n.t('submit', scope: 'devise.registration') %></p>
19
19
  <% end %>
20
20
 
@@ -13,7 +13,6 @@ module DeviseGoogleAuthenticator::Patches
13
13
  build_resource(sign_up_params)
14
14
 
15
15
  if resource.save
16
- yield resource if block_given?
17
16
  if resource.active_for_authentication?
18
17
  set_flash_message :notice, :signed_up if is_flashing_format?
19
18
  sign_in(resource_name, resource)
@@ -25,7 +25,11 @@ module DeviseGoogleAuthenticator
25
25
  end
26
26
 
27
27
  def gauth_enabled
28
- apply_devise_schema :gauth_enabled, Integer, { default: 0 }
28
+ if Rails.version >= '5.2'
29
+ apply_devise_schema :gauth_enabled, String, { default: 'f' }
30
+ else
31
+ apply_devise_schema :gauth_enabled, Integer, { default: 0 }
32
+ end
29
33
  end
30
34
 
31
35
  def gauth_tmp
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeviseGoogleAuthenticator
4
- VERSION = '0.4.0'
4
+ VERSION = '0.4.1'
5
5
  end
@@ -4,7 +4,7 @@ class DeviseGoogleAuthenticatorAddTo<%= table_name.camelize %> < ActiveRecord::M
4
4
  def self.up
5
5
  change_table :<%= table_name %> do |t|
6
6
  t.string :gauth_secret
7
- t.string :gauth_enabled, default: '0'
7
+ t.string :gauth_enabled, default: <%= Rails.version >= '5.2' ? '0' : 'f' %>
8
8
  t.string :gauth_tmp
9
9
  t.datetime :gauth_tmp_datetime
10
10
  end
@@ -11,7 +11,9 @@ module DeviseGoogleAuthenticator
11
11
  desc: 'The scope to copy views to'
12
12
 
13
13
  include ::Devise::Generators::ViewPathTemplates
14
- source_root File.expand_path('../../../../app/views/devise', __FILE__)
14
+
15
+ source_root File.expand_path('../../../app/views/devise', __dir__)
16
+
15
17
  def copy_views
16
18
  view_directory :checkga
17
19
  view_directory :displayqr
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_gauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pharmony SA
@@ -16,54 +16,54 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 5.2.8.1
19
+ version: '4.2'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '6'
22
+ version: '7'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: 5.2.8.1
29
+ version: '4.2'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '6'
32
+ version: '7'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: devise
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - "~>"
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: 4.9.3
39
+ version: '0'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - "~>"
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: 4.9.3
46
+ version: '0'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: railties
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: 5.2.8.1
53
+ version: '4.2'
54
54
  - - "<"
55
55
  - !ruby/object:Gem::Version
56
- version: '6'
56
+ version: '7'
57
57
  type: :runtime
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - "~>"
62
62
  - !ruby/object:Gem::Version
63
- version: 5.2.8.1
63
+ version: '4.2'
64
64
  - - "<"
65
65
  - !ruby/object:Gem::Version
66
- version: '6'
66
+ version: '7'
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: rotp
69
69
  requirement: !ruby/object:Gem::Requirement
@@ -141,15 +141,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - ">="
143
143
  - !ruby/object:Gem::Version
144
- version: '2.7'
144
+ version: '2.4'
145
+ - - "<"
146
+ - !ruby/object:Gem::Version
147
+ version: '3.1'
145
148
  required_rubygems_version: !ruby/object:Gem::Requirement
146
149
  requirements:
147
150
  - - ">="
148
151
  - !ruby/object:Gem::Version
149
152
  version: '0'
150
153
  requirements: []
151
- rubygems_version: 3.1.6
154
+ rubygems_version: 3.2.33
152
155
  signing_key:
153
156
  specification_version: 4
154
- summary: Devise Google Authenticator Extension
157
+ summary: Maintained Devise Google Authenticator Extension
155
158
  test_files: []