devise_sms_verifiable 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/devise/sms_verifiable_controller.rb +1 -7
- data/lib/devise_sms_verifiable.rb +9 -6
- data/lib/devise_sms_verifiable/version.rb +1 -1
- data/lib/generators/devise_sms_verifiable/install_generator.rb +2 -0
- data/lib/generators/devise_sms_verifiable/templates/README +13 -20
- metadata +25 -27
- data/README.rdoc +0 -86
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2b01a58cb30cab2945d444bb44cfdff8ebe40d4
|
4
|
+
data.tar.gz: 941904053e66f69a922d1cf51f58afa88e039519
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbf25be7649baea856593213f5d7501cdfcafe700c9112879b31e4301ea95e7768fa50c110496193a2e5233c7d2f1b66f4d3d2e33131e02d09aea4db2aa432fe
|
7
|
+
data.tar.gz: 50733909ef22e78a69831c9dcbde6ced048b78f0fb492fa1c9f358505e303450997fe971d86fb7db37d5c546590d1a827fb4a997faa85242a630d6f595f3430d
|
@@ -9,7 +9,7 @@ class Devise::SmsVerifiableController < DeviseController
|
|
9
9
|
secret = params[:user][:sms_secret]
|
10
10
|
if secret && resource.sms_secret && resource.valid_secret?(secret)
|
11
11
|
public_send("current_#{resource_name}").public_send(:update, Hash[Devise::phone_confirmation_field, true])
|
12
|
-
redirect_to
|
12
|
+
redirect_to Devise::successful_path
|
13
13
|
else
|
14
14
|
render :new
|
15
15
|
end
|
@@ -30,11 +30,5 @@ class Devise::SmsVerifiableController < DeviseController
|
|
30
30
|
instance_variable_set(:@user, _resource)
|
31
31
|
_resource
|
32
32
|
end
|
33
|
-
|
34
|
-
protected
|
35
|
-
|
36
|
-
def after_successful_phone_confirmation_path(resource)
|
37
|
-
root_path
|
38
|
-
end
|
39
33
|
end
|
40
34
|
|
@@ -21,26 +21,29 @@ module Devise
|
|
21
21
|
mattr_accessor :sms_answer_field
|
22
22
|
@@sms_answer_field = :sms_answer
|
23
23
|
|
24
|
-
mattr_accessor :sms_provider
|
25
|
-
@@sms_provider = DeviseSmsVerifiable::Provider
|
26
|
-
|
27
24
|
mattr_accessor :phone_field
|
28
25
|
@@phone_field = :phone
|
29
26
|
|
30
27
|
mattr_accessor :phone_confirmation_field
|
31
28
|
@@phone_confirmation_field = :phone_confirm
|
32
29
|
|
30
|
+
mattr_accessor :successful_path
|
31
|
+
@@successful_path = '/'
|
32
|
+
|
33
|
+
mattr_accessor :sms_provider
|
34
|
+
@@sms_provider = DeviseSmsVerifiable::Provider
|
35
|
+
|
33
36
|
mattr_accessor :provider_silent
|
34
37
|
@@provider_silent = true
|
35
38
|
|
36
39
|
mattr_accessor :provider_login
|
37
|
-
@@provider_login = '
|
40
|
+
@@provider_login = ''
|
38
41
|
|
39
42
|
mattr_accessor :provider_password
|
40
|
-
@@provider_password = '
|
43
|
+
@@provider_password = ''
|
41
44
|
|
42
45
|
mattr_accessor :provider_from
|
43
|
-
@@provider_from = '
|
46
|
+
@@provider_from = ''
|
44
47
|
end
|
45
48
|
|
46
49
|
Devise.add_module :sms_verifiable, controller: :sms_verifiables, model: 'devise_sms_verifiable/model' , route: :sms_verifiable
|
@@ -27,6 +27,8 @@ module DeviseSmsVerifiable
|
|
27
27
|
#config.phone_field = :phone
|
28
28
|
# Field in model for confirm phone(must be boolean)
|
29
29
|
#config.phone_confirmation_field = :phone_confirm
|
30
|
+
# Path after successful confirmation
|
31
|
+
#config.successful_path = '/'
|
30
32
|
# SMS provider module(have default for STREAM-TELECOM)
|
31
33
|
#config.sms_provider = DeviseSmsVerifiable::Provider
|
32
34
|
# Send sms silent for test
|
@@ -2,45 +2,38 @@
|
|
2
2
|
|
3
3
|
Some setup you must do manually if you haven't yet(in config/initializers/devise.rb):
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
You need field in model for confirm phone(must be boolean).
|
7
6
|
config.phone_confirmation_field = :phone_confirm
|
8
7
|
|
9
|
-
|
10
|
-
|
8
|
+
You need define method for check sms confirmation. (in ApplicationController)
|
11
9
|
config.sms_confirmation_method = :sms_confirmation?
|
12
10
|
|
13
|
-
|
14
|
-
|
11
|
+
Need a method that generates, writes the word model, returns the secret word. (in ApplicationController)
|
15
12
|
config.sms_secret_method = :sms_secret
|
16
13
|
|
17
|
-
|
18
|
-
|
14
|
+
Field in the model which returns the correct answer
|
19
15
|
config.sms_answer_field = :sms_answer
|
20
16
|
|
21
|
-
|
22
|
-
|
17
|
+
Field in model which phone number
|
23
18
|
config.phone_field = :phone
|
24
19
|
|
25
|
-
|
26
|
-
|
20
|
+
Path after successful confirmation
|
21
|
+
config.successful_path = '/'
|
27
22
|
|
23
|
+
SMS provider module(have default for STREAM-TELECOM) you can define own
|
24
|
+
Provider module should be a method :send_sms
|
28
25
|
config.sms_provider = DeviseSmsVerifiable::Provider
|
29
26
|
|
30
|
-
|
31
|
-
|
27
|
+
Send sms silent for test
|
32
28
|
config.provider_silent = true
|
33
29
|
|
34
|
-
|
35
|
-
|
30
|
+
SMS provider login
|
36
31
|
config.provider_login = :provider_login
|
37
32
|
|
38
|
-
|
39
|
-
|
33
|
+
SMS provider password
|
40
34
|
config.provider_password :provider_password
|
41
35
|
|
42
|
-
|
43
|
-
|
36
|
+
SMS provider from
|
44
37
|
config.provider_from :provider_from
|
45
38
|
|
46
39
|
===============================================================================
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_sms_verifiable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kiselenko Roman
|
@@ -14,126 +14,126 @@ dependencies:
|
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 4.0.3
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 4.0.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: devise
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '3.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rest_client
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec-rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: capybara
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: factory_girl_rails
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: ffaker
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: pry
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: sqlite3
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
description: |2
|
@@ -145,8 +145,11 @@ executables: []
|
|
145
145
|
extensions: []
|
146
146
|
extra_rdoc_files: []
|
147
147
|
files:
|
148
|
+
- MIT-LICENSE
|
149
|
+
- Rakefile
|
148
150
|
- app/controllers/devise/sms_verifiable_controller.rb
|
149
151
|
- app/views/devise/sms_verifiable/new.html.erb
|
152
|
+
- lib/devise_sms_verifiable.rb
|
150
153
|
- lib/devise_sms_verifiable/controllers/internal_helpers.rb
|
151
154
|
- lib/devise_sms_verifiable/controllers/url_helpers.rb
|
152
155
|
- lib/devise_sms_verifiable/engine.rb
|
@@ -155,14 +158,10 @@ files:
|
|
155
158
|
- lib/devise_sms_verifiable/provider.rb
|
156
159
|
- lib/devise_sms_verifiable/routes.rb
|
157
160
|
- lib/devise_sms_verifiable/version.rb
|
158
|
-
- lib/devise_sms_verifiable.rb
|
159
161
|
- lib/generators/devise_sms_verifiable/devise_sms_verifiable_generator.rb
|
160
162
|
- lib/generators/devise_sms_verifiable/install_generator.rb
|
161
163
|
- lib/generators/devise_sms_verifiable/templates/README
|
162
164
|
- lib/generators/devise_sms_verifiable/views_generator.rb
|
163
|
-
- MIT-LICENSE
|
164
|
-
- Rakefile
|
165
|
-
- README.rdoc
|
166
165
|
homepage: https://github.com/fishbullet/devise_sms_verifiable
|
167
166
|
licenses: []
|
168
167
|
metadata: {}
|
@@ -172,19 +171,18 @@ require_paths:
|
|
172
171
|
- lib
|
173
172
|
required_ruby_version: !ruby/object:Gem::Requirement
|
174
173
|
requirements:
|
175
|
-
- -
|
174
|
+
- - ">="
|
176
175
|
- !ruby/object:Gem::Version
|
177
176
|
version: '0'
|
178
177
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
179
178
|
requirements:
|
180
|
-
- -
|
179
|
+
- - ">="
|
181
180
|
- !ruby/object:Gem::Version
|
182
181
|
version: '0'
|
183
182
|
requirements: []
|
184
183
|
rubyforge_project:
|
185
|
-
rubygems_version: 2.
|
184
|
+
rubygems_version: 2.2.2
|
186
185
|
signing_key:
|
187
186
|
specification_version: 4
|
188
187
|
summary: DeviseSmsVerifiable it is simple fork devise_sms_activable for my project`s
|
189
188
|
test_files: []
|
190
|
-
has_rdoc:
|
data/README.rdoc
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
= DeviseSmsVerifiable
|
2
|
-
|
3
|
-
If the devise is installed, run the generator to add configuration settings:
|
4
|
-
|
5
|
-
rails generate devise_sms_verifiable:install
|
6
|
-
|
7
|
-
If devise not installed, run before generator:
|
8
|
-
|
9
|
-
rails generate devise:install
|
10
|
-
|
11
|
-
For generate views run:
|
12
|
-
|
13
|
-
rails generate devise_sms_verifiable:views
|
14
|
-
|
15
|
-
|
16
|
-
Add sms_verifiable to model:
|
17
|
-
|
18
|
-
class User < ActiveRecord::Base
|
19
|
-
# Include default devise modules. Others available are:
|
20
|
-
# :confirmable, :lockable, :timeoutable and :omniauthable
|
21
|
-
devise :database_authenticatable, :registerable,
|
22
|
-
:validatable,
|
23
|
-
:sms_verifiable,
|
24
|
-
:recoverable
|
25
|
-
end
|
26
|
-
|
27
|
-
Define 2 methods in ApplicationController
|
28
|
-
|
29
|
-
class ApplicationController < ActionController::Base
|
30
|
-
# Method for check need confirmation or no
|
31
|
-
def sms_confirmation?
|
32
|
-
return true if current_user && !current_user.phone_confirm? && current_user.phone
|
33
|
-
end
|
34
|
-
|
35
|
-
# Method generate secret write to model and return secret
|
36
|
-
def sms_secret
|
37
|
-
answer = (10..48).to_a.shuffle.take(4).join
|
38
|
-
current_user.update(sms_answer: answer)
|
39
|
-
answer
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
Add field to model.
|
44
|
-
|
45
|
-
class AddFieldToUsers < ActiveRecord::Migration
|
46
|
-
def change
|
47
|
-
# Field in the model which phone number
|
48
|
-
add_column :users, :phone, :string
|
49
|
-
# Field in the model which returns the correct answer
|
50
|
-
add_column :users, :sms_answer, :string
|
51
|
-
# Field in the model which returns phone confirm or no
|
52
|
-
add_column :users, :phone_confirm, :boolean, default: false
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
|
57
|
-
= Available options
|
58
|
-
|
59
|
-
phone_confirmation_field = :phone_confirm
|
60
|
-
|
61
|
-
sms_confirmation_method = :sms_confirmation?
|
62
|
-
|
63
|
-
sms_secret_method = :sms_secret
|
64
|
-
|
65
|
-
sms_answer_field = :sms_answer
|
66
|
-
|
67
|
-
phone_field = :phone
|
68
|
-
|
69
|
-
SMS provider module(have default for STREAM-TELECOM) you can define own
|
70
|
-
Provider module should be a method :send_sms
|
71
|
-
|
72
|
-
sms_provider = DeviseSmsVerifiable::Provider
|
73
|
-
|
74
|
-
provider_silent = true
|
75
|
-
|
76
|
-
provider_login = :provider_login
|
77
|
-
|
78
|
-
provider_password :provider_password
|
79
|
-
|
80
|
-
provider_from :provider_from
|
81
|
-
|
82
|
-
===============================================================================
|
83
|
-
|
84
|
-
Kiselenko Roman 2014-03-16
|
85
|
-
|
86
|
-
This project rocks and uses MIT-LICENSE.
|