safeguard-devise 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Gemfile +1 -1
- data/Gemfile.lock +2 -2
- data/README.md +12 -6
- data/app/assets/stylesheets/devise_safeguard.css +22 -3
- data/app/assets/stylesheets/devise_safeguard.sass +18 -3
- data/app/controllers/devise/devise_safeguard_controller.rb +2 -1
- data/app/views/devise/verify_safeguard.html.erb +14 -1
- data/app/views/devise/verify_safeguard.html.haml +12 -1
- data/config/locales/en.yml +2 -0
- data/config/locales/pt-BR.yml +3 -1
- data/lib/generators/devise_safeguard/install_generator.rb +1 -0
- data/safeguard-devise.gemspec +1 -2
- data/spec/safeguard-devise-test-app/Gemfile.lock +2 -2
- data/spec/safeguard-devise-test-app/app/assets/stylesheets/devise_safeguard.css +22 -3
- data/spec/safeguard-devise-test-app/app/views/devise/devise_safeguard/verify_safeguard.html.erb +14 -1
- data/spec/safeguard-devise-test-app/config/initializers/devise.rb +5 -0
- data/spec/safeguard-devise-test-app/config/locales/devise.safeguard.en.yml +2 -0
- data/spec/safeguard-devise-test-app/config/locales/devise.safeguard.pt-BR.yml +3 -1
- metadata +1 -2
- data/safeguard-devise-0.0.2.gem +0 -0
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTcyZjJkM2M3MGU2NDMwOTA2MGU0ZWNiN2JmYTk4ZjFmMDk5MTRjNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTEzZDY2MzEzNjU3NTFmZGYyZmQ3ODhmMDcwNzI2YWUzZTg2MTBmMw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjgyOTJlOTljYWFhOWUxZmRmMDEyYjQyZjgxNjBlMTVmNTA1YTNkODljMmU5
|
10
|
+
NWEwZjJjZWFmNTk1YWFiYzg5MzlmOTBjODNhYmRkMTEwODU5MTIzNGExZTY2
|
11
|
+
NTZkODI5N2UwNWYzN2I4ODk3MjkxNzc1ODMyMWVlZjBmZTI2OTY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZGRkMTI5YTY2MmY5NDMyN2ViMmRiYmFiNGFhMzM5MTFmZDM2OWJhZDMzZjI2
|
14
|
+
ZjZhNTUwMTcxM2NkN2ZmYmNiOGEyYTRhMzcxZTYzMDBmMzcyY2Q1OTU1NmJl
|
15
|
+
OWZjYmZiYzc2NTc3NDlmOGRhMWIxY2VhOGQ2ZDAwZTA4MDcyOWM=
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -130,7 +130,7 @@ GEM
|
|
130
130
|
rspec-core (~> 2.14.0)
|
131
131
|
rspec-expectations (~> 2.14.0)
|
132
132
|
rspec-mocks (~> 2.14.0)
|
133
|
-
safeguard-api (0.2.
|
133
|
+
safeguard-api (0.2.1)
|
134
134
|
httpclient (>= 2.3.4)
|
135
135
|
sass (3.2.14)
|
136
136
|
sass-rails (4.0.1)
|
@@ -179,7 +179,7 @@ DEPENDENCIES
|
|
179
179
|
rdoc
|
180
180
|
rspec
|
181
181
|
rspec-rails
|
182
|
-
safeguard-api
|
182
|
+
safeguard-api (= 0.2.1)
|
183
183
|
sass-rails
|
184
184
|
simplecov
|
185
185
|
sqlite3
|
data/README.md
CHANGED
@@ -3,15 +3,21 @@
|
|
3
3
|
## Instalação
|
4
4
|
|
5
5
|
Adicione as seguintes linhas nos arquivos de configurações
|
6
|
-
|
7
|
-
|
6
|
+
|
7
|
+
>Safeguard.api_url=[API_URL]
|
8
|
+
|
9
|
+
>Safeguard.api_key=[API_KEY]
|
8
10
|
|
9
11
|
Adiciona a gem do safeguard no Gemfile
|
10
|
-
|
12
|
+
|
13
|
+
>gem 'devise-safeguard'
|
11
14
|
|
12
15
|
Execute o comando abaixo para criar/editar os arquivos necessários para o funcionamento da Gem
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
+
|
17
|
+
>rails g devise_safeguard:install
|
18
|
+
|
19
|
+
>rails g devise_safeguard [MODEL]
|
20
|
+
|
21
|
+
>rake db:migrate
|
16
22
|
|
17
23
|
|
@@ -1,17 +1,28 @@
|
|
1
1
|
#safeguard-form-token{
|
2
|
-
width:
|
2
|
+
width: 312px;
|
3
|
+
font-size: 15px;
|
3
4
|
position: relative;
|
4
5
|
left: 50%;
|
5
|
-
margin-left: -
|
6
|
+
margin-left: -166px;
|
6
7
|
margin-top: 100px;
|
7
8
|
font-family: 'OpenSansRegular', sans-serif;
|
8
9
|
}
|
9
10
|
|
11
|
+
#safeguard-form-token .devise-logo-safeguard{
|
12
|
+
background: url("devise_logo_safeguard.png") no-repeat;
|
13
|
+
position: relative;
|
14
|
+
float: left;
|
15
|
+
height: 65px;
|
16
|
+
width: 100%;
|
17
|
+
text-align: center;
|
18
|
+
left: 37px;
|
19
|
+
}
|
20
|
+
|
10
21
|
#safeguard-form-token form{
|
11
22
|
background: none repeat scroll 0 0 #FBFBFB;
|
12
23
|
border: 1px solid #E5E5E5;
|
13
24
|
font-weight: normal;
|
14
|
-
height:
|
25
|
+
height: 160px;
|
15
26
|
margin-left: 8px;
|
16
27
|
padding: 26px 24px 46px;
|
17
28
|
}
|
@@ -61,3 +72,11 @@
|
|
61
72
|
background-clip: padding-box;
|
62
73
|
background: #fff;
|
63
74
|
}
|
75
|
+
|
76
|
+
#safeguard-form-token .token-type{
|
77
|
+
font-size: 14px;
|
78
|
+
position: relative;
|
79
|
+
float: left;
|
80
|
+
padding-right: 20px;
|
81
|
+
padding-bottom: 20px;
|
82
|
+
}
|
@@ -1,15 +1,24 @@
|
|
1
1
|
#safeguard-form-token
|
2
|
-
width:
|
2
|
+
width: 312px
|
3
|
+
font-size: 15px
|
3
4
|
position: relative
|
4
5
|
left: 50%
|
5
|
-
margin-left: -
|
6
|
+
margin-left: -166px
|
6
7
|
margin-top: 100px
|
7
8
|
font-family: 'OpenSansRegular', sans-serif
|
9
|
+
.devise-logo-safeguard
|
10
|
+
background: url("devise_logo_safeguard.png") no-repeat
|
11
|
+
position: relative
|
12
|
+
float: left
|
13
|
+
height: 65px
|
14
|
+
width: 100%
|
15
|
+
text-align: center
|
16
|
+
left: 37px
|
8
17
|
form
|
9
18
|
background: none repeat scroll 0 0 #FBFBFB
|
10
19
|
border: 1px solid #E5E5E5
|
11
20
|
font-weight: normal
|
12
|
-
height:
|
21
|
+
height: 160px
|
13
22
|
margin-left: 8px
|
14
23
|
padding: 26px 24px 46px
|
15
24
|
#safeguard-token
|
@@ -54,3 +63,9 @@
|
|
54
63
|
-webkit-background-clip: padding-box
|
55
64
|
background-clip: padding-box
|
56
65
|
background: #fff
|
66
|
+
.token-type
|
67
|
+
font-size: 14px
|
68
|
+
position: relative
|
69
|
+
float: left
|
70
|
+
padding-right: 20px
|
71
|
+
padding-bottom: 20px
|
@@ -28,7 +28,8 @@ class Devise::DeviseSafeguardController < DeviseController
|
|
28
28
|
def token_ok?
|
29
29
|
resp = Safeguard::API.is_valid?({
|
30
30
|
:email => @resource.email,
|
31
|
-
:token => params[:safeguard_token]
|
31
|
+
:token => params[:safeguard_token],
|
32
|
+
:token_type => params[:token][:type]
|
32
33
|
})
|
33
34
|
resp
|
34
35
|
end
|
@@ -1,9 +1,22 @@
|
|
1
1
|
<%= stylesheet_link_tag "devise_safeguard", :media => "all" %>
|
2
2
|
<div id="safeguard-form-token">
|
3
3
|
<%= form_tag([resource_name, :verify_safeguard], :id => 'devise_safeguard', :class => 'safeguard-form', :method => :post) do %>
|
4
|
+
<div class="devise-logo-safeguard"></div>
|
4
5
|
<%= hidden_field_tag(:"#{resource_name}_id", @resource.email) %>
|
5
|
-
|
6
|
+
<label>
|
7
|
+
<%= I18n.t('devise.safeguard_form_title') %>
|
8
|
+
</label>
|
6
9
|
<%= text_field_tag :safeguard_token, "", :autocomplete => :off, :id => 'safeguard-token' %>
|
10
|
+
<div class="token-types">
|
11
|
+
<div class="normal-token token-type">
|
12
|
+
<%= radio_button 'token', 'type', 'normal', checked: 'checked' %>
|
13
|
+
<%= I18n.t('devise.safeguard_token_normal') %>
|
14
|
+
</div>
|
15
|
+
<div class="smartphone-token token-type">
|
16
|
+
<%= radio_button 'token', 'type', 'smartphone' %>
|
17
|
+
<%= I18n.t('devise.safeguard_token_smartphone') %>
|
18
|
+
</div>
|
19
|
+
</div>
|
7
20
|
<%= submit_tag I18n.t('safeguard_token_button', {:scope => 'devise'}), :class => 'button' %>
|
8
21
|
<% end %>
|
9
22
|
</div>
|
@@ -1,7 +1,18 @@
|
|
1
1
|
= stylesheet_link_tag "devise_safeguard", :media => "all"
|
2
2
|
#safeguard-form-token
|
3
3
|
= form_tag([resource_name, :verify_safeguard], :id => 'devise_safeguard', :class => 'safeguard-form', :method => :post) do
|
4
|
+
.devise-logo-safeguard
|
4
5
|
= hidden_field_tag(:"#{resource_name}_id", @resource.email)
|
5
|
-
|
6
|
+
%label
|
7
|
+
= I18n.t('devise.safeguard_form_title')
|
6
8
|
= text_field_tag :safeguard_token, "", :autocomplete => :off, :id => 'safeguard-token'
|
9
|
+
.token-types
|
10
|
+
|
11
|
+
.normal-token.token-type
|
12
|
+
= radio_button 'token', 'type', 'normal', checked: 'checked'
|
13
|
+
= I18n.t('devise.safeguard_token_normal')
|
14
|
+
.smartphone-token.token-type
|
15
|
+
= radio_button 'token', 'type', 'smartphone'
|
16
|
+
= I18n.t('devise.safeguard_token_smartphone')
|
7
17
|
= submit_tag I18n.t('safeguard_token_button', {:scope => 'devise'}), :class => 'button'
|
18
|
+
|
data/config/locales/en.yml
CHANGED
data/config/locales/pt-BR.yml
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
pt-BR:
|
2
2
|
devise:
|
3
|
-
safeguard_form_title:
|
3
|
+
safeguard_form_title: Informe a senha do seu token
|
4
4
|
safeguard_token_button: Enviar senha
|
5
5
|
safeguard_token: Token
|
6
|
+
safeguard_token_normal: Padrão
|
7
|
+
safeguard_token_smartphone: Smartphone
|
@@ -35,6 +35,7 @@ module DeviseSafeguard
|
|
35
35
|
else
|
36
36
|
copy_file '../../../app/assets/stylesheets/devise_safeguard.css', 'app/assets/stylesheets/devise_safeguard.css'
|
37
37
|
end
|
38
|
+
copy_file '../../../app/assets/images/logo_safeguard.png', 'app/assets/images/devise_logo_safeguard.png'
|
38
39
|
end
|
39
40
|
|
40
41
|
def inject_assets_in_layout
|
data/safeguard-devise.gemspec
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "safeguard-devise"
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.4"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
@@ -131,7 +131,6 @@ Gem::Specification.new do |s|
|
|
131
131
|
"puppet/modules/redis/templates/redis.rhel.conf.erb",
|
132
132
|
"puppet/modules/redis/tests/init.pp",
|
133
133
|
"puppet/upgrade-puppet.sh",
|
134
|
-
"safeguard-devise-0.0.2.gem",
|
135
134
|
"safeguard-devise.gemspec",
|
136
135
|
"spec/controllers/safeguard_devise_controller_spec.rb",
|
137
136
|
"spec/devise/safeguard_authenticatable_spec.rb",
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../..
|
3
3
|
specs:
|
4
|
-
safeguard-devise (0.0.
|
4
|
+
safeguard-devise (0.0.4)
|
5
5
|
devise
|
6
6
|
safeguard-api
|
7
7
|
|
@@ -82,7 +82,7 @@ GEM
|
|
82
82
|
rake (>= 0.8.7)
|
83
83
|
thor (>= 0.18.1, < 2.0)
|
84
84
|
rake (10.1.1)
|
85
|
-
safeguard-api (0.2.
|
85
|
+
safeguard-api (0.2.1)
|
86
86
|
httpclient (>= 2.3.4)
|
87
87
|
sprockets (2.11.0)
|
88
88
|
hike (~> 1.2)
|
@@ -1,17 +1,28 @@
|
|
1
1
|
#safeguard-form-token{
|
2
|
-
width:
|
2
|
+
width: 312px;
|
3
|
+
font-size: 15px;
|
3
4
|
position: relative;
|
4
5
|
left: 50%;
|
5
|
-
margin-left: -
|
6
|
+
margin-left: -166px;
|
6
7
|
margin-top: 100px;
|
7
8
|
font-family: 'OpenSansRegular', sans-serif;
|
8
9
|
}
|
9
10
|
|
11
|
+
#safeguard-form-token .devise-logo-safeguard{
|
12
|
+
background: url("devise_logo_safeguard.png") no-repeat;
|
13
|
+
position: relative;
|
14
|
+
float: left;
|
15
|
+
height: 65px;
|
16
|
+
width: 100%;
|
17
|
+
text-align: center;
|
18
|
+
left: 37px;
|
19
|
+
}
|
20
|
+
|
10
21
|
#safeguard-form-token form{
|
11
22
|
background: none repeat scroll 0 0 #FBFBFB;
|
12
23
|
border: 1px solid #E5E5E5;
|
13
24
|
font-weight: normal;
|
14
|
-
height:
|
25
|
+
height: 160px;
|
15
26
|
margin-left: 8px;
|
16
27
|
padding: 26px 24px 46px;
|
17
28
|
}
|
@@ -61,3 +72,11 @@
|
|
61
72
|
background-clip: padding-box;
|
62
73
|
background: #fff;
|
63
74
|
}
|
75
|
+
|
76
|
+
#safeguard-form-token .token-type{
|
77
|
+
font-size: 14px;
|
78
|
+
position: relative;
|
79
|
+
float: left;
|
80
|
+
padding-right: 20px;
|
81
|
+
padding-bottom: 20px;
|
82
|
+
}
|
data/spec/safeguard-devise-test-app/app/views/devise/devise_safeguard/verify_safeguard.html.erb
CHANGED
@@ -1,9 +1,22 @@
|
|
1
1
|
<%= stylesheet_link_tag "devise_safeguard", :media => "all" %>
|
2
2
|
<div id="safeguard-form-token">
|
3
3
|
<%= form_tag([resource_name, :verify_safeguard], :id => 'devise_safeguard', :class => 'safeguard-form', :method => :post) do %>
|
4
|
+
<div class="devise-logo-safeguard"></div>
|
4
5
|
<%= hidden_field_tag(:"#{resource_name}_id", @resource.email) %>
|
5
|
-
|
6
|
+
<label>
|
7
|
+
<%= I18n.t('devise.safeguard_form_title') %>
|
8
|
+
</label>
|
6
9
|
<%= text_field_tag :safeguard_token, "", :autocomplete => :off, :id => 'safeguard-token' %>
|
10
|
+
<div class="token-types">
|
11
|
+
<div class="normal-token token-type">
|
12
|
+
<%= radio_button 'token', 'type', 'normal', checked: 'checked' %>
|
13
|
+
<%= I18n.t('devise.safeguard_token_normal') %>
|
14
|
+
</div>
|
15
|
+
<div class="smartphone-token token-type">
|
16
|
+
<%= radio_button 'token', 'type', 'smartphone' %>
|
17
|
+
<%= I18n.t('devise.safeguard_token_smartphone') %>
|
18
|
+
</div>
|
19
|
+
</div>
|
7
20
|
<%= submit_tag I18n.t('safeguard_token_button', {:scope => 'devise'}), :class => 'button' %>
|
8
21
|
<% end %>
|
9
22
|
</div>
|
@@ -256,4 +256,9 @@ Devise.setup do |config|
|
|
256
256
|
# How long should the user's device be remembered for.
|
257
257
|
# config.safeguard_remember_device = 1.month
|
258
258
|
|
259
|
+
|
260
|
+
# ==> Devise Safeguard Authentication Extension
|
261
|
+
# How long should the user's device be remembered for.
|
262
|
+
# config.safeguard_remember_device = 1.month
|
263
|
+
|
259
264
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
pt-BR:
|
2
2
|
devise:
|
3
|
-
safeguard_form_title: Por favor informe a senha do seu token
|
3
|
+
safeguard_form_title: Por favor informe a senha do seu token
|
4
4
|
safeguard_token_button: Enviar senha
|
5
5
|
safeguard_token: Token
|
6
|
+
safeguard_token_normal: Padrão
|
7
|
+
safeguard_token_smartphone: Smartphone
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: safeguard-devise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- diegonakamashi
|
@@ -284,7 +284,6 @@ files:
|
|
284
284
|
- puppet/modules/redis/templates/redis.rhel.conf.erb
|
285
285
|
- puppet/modules/redis/tests/init.pp
|
286
286
|
- puppet/upgrade-puppet.sh
|
287
|
-
- safeguard-devise-0.0.2.gem
|
288
287
|
- safeguard-devise.gemspec
|
289
288
|
- spec/controllers/safeguard_devise_controller_spec.rb
|
290
289
|
- spec/devise/safeguard_authenticatable_spec.rb
|
data/safeguard-devise-0.0.2.gem
DELETED
Binary file
|