devise_phone 0.0.166 → 0.0.1661
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +40 -31
- data/lib/devise_phone/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbe42d3c22685ac7b09bd947b1c2f104851d60a5
|
4
|
+
data.tar.gz: fd6796e5978e541bf11e71db29b23db842be60ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1f251105637d81644f7d46f32cd461b55c75e92870f0f364c2de210cb837fb5d87b3d717a44c52f580677132443128f8f5027fafc0deba3a5074a6d4ce781de
|
7
|
+
data.tar.gz: 9622833e283c0581371135e7824c2cab59cd9ccb2073ecdb20a875ee8d3977739da131f1ceb7962cd47a0790c1341f790419dfdc5ae998749ed923e3e92e5ff8
|
data/README.rdoc
CHANGED
@@ -1,28 +1,27 @@
|
|
1
|
-
=
|
1
|
+
= devise_phone
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
Ask the user his phone (and phone confirmation to double check) on registration and the token will be sended automagically.
|
6
|
-
|
7
|
-
== Installation for Rails >= 3.0 and Devise >= 1.1
|
8
|
-
|
9
|
-
Install DevisePhone gem, it will also install dependencies (such as devise and warden):
|
10
|
-
|
11
|
-
gem install devise_phone
|
3
|
+
The user will receive an SMS with a token that can be entered on the site to activate the phone number.
|
4
|
+
Ask the user his phone and the token will be sended automagically.
|
12
5
|
|
13
6
|
Add DevisePhone to your Gemfile (and Devise and TwilioRuby if you weren't using them):
|
14
7
|
|
15
|
-
gem 'devise'
|
16
|
-
gem 'twilio-ruby'
|
17
|
-
gem 'devise_phone'
|
8
|
+
gem 'devise'
|
9
|
+
gem 'twilio-ruby'
|
10
|
+
gem 'devise_phone'
|
18
11
|
|
19
12
|
=== Automatic installation
|
20
13
|
|
14
|
+
Run:
|
15
|
+
rails generate devise:install
|
16
|
+
rails generate devise MODEL
|
17
|
+
rails generate devise:views MODEL
|
18
|
+
before installing devise_phone in your Rails app
|
19
|
+
|
21
20
|
Run the following generator to add DevisePhone’s configuration option in the Devise configuration file (config/initializers/devise.rb) and the sms sender class in your lib folder:
|
22
21
|
|
23
22
|
rails generate devise_phone:install
|
24
23
|
|
25
|
-
When you are done, you are ready to add DevisePhone to any of your Devise models using the following generator:
|
24
|
+
When you are done, you are ready to add DevisePhone to any of your Devise models using the following generator:
|
26
25
|
|
27
26
|
rails generate devise_phone MODEL
|
28
27
|
|
@@ -34,7 +33,7 @@ All the views are packaged inside the gem. If you'd like to customize the views,
|
|
34
33
|
|
35
34
|
rails generate devise_phone:views
|
36
35
|
|
37
|
-
You can also use the generator to generate scoped views:
|
36
|
+
You can also use the generator to generate scoped views: (This might not work yet)
|
38
37
|
|
39
38
|
rails generate devise_phone:views users
|
40
39
|
|
@@ -42,30 +41,40 @@ Please refer to {Devise's README}[http://github.com/plataformatec/devise] for mo
|
|
42
41
|
|
43
42
|
== Usage
|
44
43
|
|
45
|
-
|
44
|
+
Don't forget to add phone_number as one of the permitted parameters. This is an example of doing so:
|
45
|
+
|
46
|
+
class ApplicationController < ActionController::Base
|
47
|
+
# Prevent CSRF attacks by raising an exception.
|
48
|
+
# For APIs, you may want to use :null_session instead.
|
49
|
+
protect_from_forgery with: :exception
|
50
|
+
|
51
|
+
before_filter :configure_permitted_parameters
|
46
52
|
|
47
|
-
|
48
|
-
By default users MUST activate by SMS before entering.
|
49
|
-
If you want something more "relaxed" just override <tt>sms_confirmation_required?</tt> in your model and make it your way.
|
50
|
-
You can use the convenience filter <tt>require_sms_activated!</tt> in your controller to block sms-unactive users from specific pages.
|
53
|
+
protected
|
51
54
|
|
52
|
-
|
55
|
+
# my custom fields are :name, :heard_how
|
56
|
+
def configure_permitted_parameters
|
57
|
+
devise_parameter_sanitizer.for(:sign_up) do |u|
|
58
|
+
u.permit(:phone_number,
|
59
|
+
:email, :password, :password_confirmation)
|
60
|
+
end
|
61
|
+
devise_parameter_sanitizer.for(:account_update) do |u|
|
62
|
+
u.permit(:phone_number,
|
63
|
+
:email, :password, :password_confirmation, :current_password)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
53
67
|
|
54
|
-
|
68
|
+
The resend verification code button can be inserted to any page just by using:
|
69
|
+
<%= render 'devise/phone/resend_code' %>
|
55
70
|
|
56
|
-
|
71
|
+
The activate phone field and button can be inserted to any page just by using:
|
72
|
+
<%= render 'devise/phone/activate_phone' %>
|
57
73
|
|
58
|
-
DevisePhone installs a localizable file in your config/locales folder.
|
59
74
|
|
60
75
|
== Contributing to devise_phone
|
61
76
|
|
62
|
-
*
|
63
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
64
|
-
* Fork the project
|
65
|
-
* Start a feature/bugfix branch
|
66
|
-
* Commit and push until you are happy with your contribution
|
67
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
68
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
77
|
+
* email htheodore@gmail.com
|
69
78
|
|
70
79
|
== Copyright
|
71
80
|
|
data/lib/devise_phone/version.rb
CHANGED