loyal_devise 2.1.2 → 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/.travis.yml +14 -9
- data/.yardopts +9 -0
- data/CHANGELOG.rdoc +60 -5
- data/CONTRIBUTING.md +4 -2
- data/Gemfile +7 -7
- data/Gemfile.lock +107 -101
- data/MIT-LICENSE +1 -1
- data/README.md +110 -48
- data/Rakefile +1 -0
- data/app/controllers/devise/confirmations_controller.rb +2 -4
- data/app/controllers/devise/omniauth_callbacks_controller.rb +0 -1
- data/app/controllers/devise/passwords_controller.rb +16 -5
- data/app/controllers/devise/registrations_controller.rb +13 -7
- data/app/controllers/devise/sessions_controller.rb +6 -6
- data/app/controllers/devise/unlocks_controller.rb +3 -4
- data/app/controllers/devise_controller.rb +12 -33
- data/app/helpers/devise_helper.rb +0 -1
- data/app/mailers/devise/mailer.rb +7 -8
- data/app/views/devise/mailer/confirmation_instructions.html.erb +1 -1
- data/app/views/devise/mailer/reset_password_instructions.html.erb +1 -1
- data/app/views/devise/registrations/edit.html.erb +5 -1
- data/config/locales/en.yml +48 -48
- data/devise.gemspec +6 -6
- data/devise.png +0 -0
- data/gemfiles/{Gemfile.rails-3.1.x → Gemfile.rails-3.2.x} +8 -12
- data/gemfiles/Gemfile.rails-3.2.x.lock +156 -0
- data/lib/devise.rb +34 -11
- data/lib/devise/controllers/helpers.rb +33 -7
- data/lib/devise/controllers/rememberable.rb +6 -3
- data/lib/devise/controllers/scoped_views.rb +1 -2
- data/lib/devise/controllers/url_helpers.rb +0 -1
- data/lib/devise/delegator.rb +0 -1
- data/lib/devise/failure_app.rb +8 -2
- data/lib/devise/hooks/activatable.rb +1 -2
- data/lib/devise/hooks/forgetable.rb +0 -1
- data/lib/devise/hooks/lockable.rb +1 -2
- data/lib/devise/hooks/rememberable.rb +1 -2
- data/lib/devise/hooks/timeoutable.rb +0 -1
- data/lib/devise/hooks/trackable.rb +0 -1
- data/lib/devise/mailers/helpers.rb +18 -14
- data/lib/devise/mapping.rb +6 -7
- data/lib/devise/models.rb +0 -1
- data/lib/devise/models/authenticatable.rb +50 -27
- data/lib/devise/models/confirmable.rb +37 -16
- data/lib/devise/models/database_authenticatable.rb +17 -3
- data/lib/devise/models/lockable.rb +1 -2
- data/lib/devise/models/omniauthable.rb +1 -2
- data/lib/devise/models/recoverable.rb +10 -6
- data/lib/devise/models/registerable.rb +0 -1
- data/lib/devise/models/rememberable.rb +1 -2
- data/lib/devise/models/timeoutable.rb +1 -2
- data/lib/devise/models/token_authenticatable.rb +0 -1
- data/lib/devise/models/trackable.rb +0 -1
- data/lib/devise/models/validatable.rb +0 -1
- data/lib/devise/modules.rb +1 -2
- data/lib/devise/omniauth.rb +0 -1
- data/lib/devise/omniauth/config.rb +0 -1
- data/lib/devise/omniauth/url_helpers.rb +0 -1
- data/lib/devise/orm/active_record.rb +1 -2
- data/lib/devise/orm/mongoid.rb +1 -2
- data/lib/devise/{param_filter.rb → parameter_filter.rb} +10 -12
- data/lib/devise/parameter_sanitizer.rb +59 -0
- data/lib/devise/rails.rb +0 -1
- data/lib/devise/rails/routes.rb +22 -18
- data/lib/devise/rails/warden_compat.rb +0 -30
- data/lib/devise/strategies/authenticatable.rb +8 -6
- data/lib/devise/strategies/base.rb +1 -2
- data/lib/devise/strategies/database_authenticatable.rb +1 -2
- data/lib/devise/strategies/rememberable.rb +1 -2
- data/lib/devise/strategies/token_authenticatable.rb +38 -4
- data/lib/devise/test_helpers.rb +0 -1
- data/lib/devise/time_inflector.rb +1 -2
- data/lib/devise/version.rb +1 -2
- data/lib/generators/active_record/devise_generator.rb +1 -5
- data/lib/generators/active_record/templates/migration.rb +0 -1
- data/lib/generators/active_record/templates/migration_existing.rb +0 -1
- data/lib/generators/devise/devise_generator.rb +0 -1
- data/lib/generators/devise/install_generator.rb +0 -1
- data/lib/generators/devise/orm_helpers.rb +1 -2
- data/lib/generators/devise/views_generator.rb +8 -3
- data/lib/generators/mongoid/devise_generator.rb +1 -2
- data/lib/generators/templates/README +1 -1
- data/lib/generators/templates/devise.rb +10 -5
- data/lib/generators/templates/markerb/confirmation_instructions.markerb +1 -1
- data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +1 -0
- data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +6 -1
- data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +1 -0
- data/loyal_devise.gemspec +27 -0
- data/test/controllers/custom_strategy_test.rb +0 -1
- data/test/controllers/helpers_test.rb +0 -1
- data/test/controllers/internal_helpers_test.rb +13 -4
- data/test/controllers/passwords_controller_test.rb +32 -0
- data/test/controllers/sessions_controller_test.rb +28 -1
- data/test/controllers/url_helpers_test.rb +0 -1
- data/test/delegator_test.rb +0 -1
- data/test/devise_test.rb +12 -2
- data/test/failure_app_test.rb +3 -4
- data/test/generators/active_record_generator_test.rb +1 -4
- data/test/generators/devise_generator_test.rb +0 -1
- data/test/generators/install_generator_test.rb +0 -1
- data/test/generators/mongoid_generator_test.rb +0 -1
- data/test/generators/views_generator_test.rb +16 -2
- data/test/helpers/devise_helper_test.rb +1 -2
- data/test/integration/authenticatable_test.rb +92 -27
- data/test/integration/confirmable_test.rb +7 -7
- data/test/integration/database_authenticatable_test.rb +8 -7
- data/test/integration/http_authenticatable_test.rb +19 -2
- data/test/integration/lockable_test.rb +1 -2
- data/test/integration/omniauthable_test.rb +2 -3
- data/test/integration/recoverable_test.rb +40 -12
- data/test/integration/registerable_test.rb +17 -14
- data/test/integration/rememberable_test.rb +16 -10
- data/test/integration/timeoutable_test.rb +11 -2
- data/test/integration/token_authenticatable_test.rb +45 -2
- data/test/integration/trackable_test.rb +1 -2
- data/test/mailers/confirmation_instructions_test.rb +11 -3
- data/test/mailers/reset_password_instructions_test.rb +11 -3
- data/test/mailers/unlock_instructions_test.rb +11 -2
- data/test/mapping_test.rb +0 -1
- data/test/models/authenticatable_test.rb +6 -1
- data/test/models/confirmable_test.rb +53 -2
- data/test/models/database_authenticatable_test.rb +57 -21
- data/test/models/lockable_test.rb +1 -2
- data/test/models/omniauthable_test.rb +0 -1
- data/test/models/recoverable_test.rb +21 -5
- data/test/models/registerable_test.rb +0 -1
- data/test/models/rememberable_test.rb +4 -4
- data/test/models/serializable_test.rb +8 -8
- data/test/models/timeoutable_test.rb +0 -1
- data/test/models/token_authenticatable_test.rb +0 -1
- data/test/models/trackable_test.rb +0 -1
- data/test/models/validatable_test.rb +16 -6
- data/test/models_test.rb +7 -24
- data/test/omniauth/config_test.rb +1 -2
- data/test/omniauth/url_helpers_test.rb +4 -2
- data/test/orm/active_record.rb +1 -1
- data/test/orm/mongoid.rb +2 -4
- data/test/parameter_sanitizer_test.rb +51 -0
- data/test/rails_app/Rakefile +0 -4
- data/test/rails_app/app/active_record/admin.rb +0 -1
- data/test/rails_app/app/active_record/shim.rb +1 -2
- data/test/rails_app/app/active_record/user.rb +0 -1
- data/test/rails_app/app/controllers/admins/sessions_controller.rb +1 -2
- data/test/rails_app/app/controllers/admins_controller.rb +0 -1
- data/test/rails_app/app/controllers/application_controller.rb +1 -1
- data/test/rails_app/app/controllers/home_controller.rb +0 -1
- data/test/rails_app/app/controllers/publisher/registrations_controller.rb +1 -2
- data/test/rails_app/app/controllers/publisher/sessions_controller.rb +1 -2
- data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +1 -2
- data/test/rails_app/app/controllers/users_controller.rb +8 -1
- data/test/rails_app/app/helpers/application_helper.rb +0 -1
- data/test/rails_app/app/mailers/users/mailer.rb +4 -1
- data/test/rails_app/app/mongoid/admin.rb +4 -3
- data/test/rails_app/app/mongoid/shim.rb +3 -5
- data/test/rails_app/app/mongoid/user.rb +2 -3
- data/test/rails_app/app/views/users/edit_form.html.erb +1 -0
- data/test/rails_app/bin/bundle +3 -0
- data/test/rails_app/bin/rails +4 -0
- data/test/rails_app/bin/rake +4 -0
- data/test/rails_app/config/application.rb +1 -3
- data/test/rails_app/config/boot.rb +3 -4
- data/test/rails_app/config/environment.rb +2 -3
- data/test/rails_app/config/environments/development.rb +23 -8
- data/test/rails_app/config/environments/production.rb +68 -18
- data/test/rails_app/config/environments/test.rb +18 -16
- data/test/rails_app/config/initializers/backtrace_silencers.rb +0 -1
- data/test/rails_app/config/initializers/devise.rb +0 -1
- data/test/rails_app/config/initializers/inflections.rb +0 -1
- data/test/rails_app/config/initializers/secret_token.rb +8 -3
- data/test/rails_app/config/initializers/session_store.rb +1 -0
- data/test/rails_app/config/routes.rb +20 -17
- data/test/rails_app/db/migrate/20100401102949_create_tables.rb +0 -1
- data/test/rails_app/db/schema.rb +0 -1
- data/test/rails_app/lib/shared_admin.rb +0 -1
- data/test/rails_app/lib/shared_user.rb +0 -2
- data/test/routes_test.rb +22 -21
- data/test/support/assertions.rb +0 -1
- data/test/support/helpers.rb +1 -2
- data/test/support/integration.rb +0 -1
- data/test/support/webrat/integrations/rails.rb +0 -1
- data/test/test_helper.rb +8 -2
- data/test/test_helpers_test.rb +0 -1
- data/test/test_models.rb +26 -0
- metadata +65 -27
- data/gemfiles/Gemfile.rails-3.1.x.lock +0 -167
- data/test/indifferent_hash.rb +0 -34
- data/test/rails_app/script/rails +0 -10
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# encoding: UTF-8
|
2
2
|
require 'test_helper'
|
3
3
|
|
4
4
|
class ValidatableTest < ActiveSupport::TestCase
|
@@ -56,10 +56,15 @@ class ValidatableTest < ActiveSupport::TestCase
|
|
56
56
|
test 'should require confirmation to be set when creating a new record' do
|
57
57
|
user = new_user(:password => 'new_password', :password_confirmation => 'blabla')
|
58
58
|
assert user.invalid?
|
59
|
-
|
59
|
+
|
60
|
+
if Devise.rails4?
|
61
|
+
assert_equal 'doesn\'t match Password', user.errors[:password_confirmation].join
|
62
|
+
else
|
63
|
+
assert_equal 'doesn\'t match confirmation', user.errors[:password].join
|
64
|
+
end
|
60
65
|
end
|
61
66
|
|
62
|
-
test 'should require password when updating/
|
67
|
+
test 'should require password when updating/resetting password' do
|
63
68
|
user = create_user
|
64
69
|
|
65
70
|
user.password = ''
|
@@ -69,11 +74,16 @@ class ValidatableTest < ActiveSupport::TestCase
|
|
69
74
|
assert_equal 'can\'t be blank', user.errors[:password].join
|
70
75
|
end
|
71
76
|
|
72
|
-
test 'should require confirmation when updating/
|
77
|
+
test 'should require confirmation when updating/resetting password' do
|
73
78
|
user = create_user
|
74
79
|
user.password_confirmation = 'another_password'
|
75
80
|
assert user.invalid?
|
76
|
-
|
81
|
+
|
82
|
+
if Devise.rails4?
|
83
|
+
assert_equal 'doesn\'t match Password', user.errors[:password_confirmation].join
|
84
|
+
else
|
85
|
+
assert_equal 'doesn\'t match confirmation', user.errors[:password].join
|
86
|
+
end
|
77
87
|
end
|
78
88
|
|
79
89
|
test 'should require a password with minimum of 6 characters' do
|
@@ -98,7 +108,7 @@ class ValidatableTest < ActiveSupport::TestCase
|
|
98
108
|
assert_not (user.errors[:password].join =~ /is too long/)
|
99
109
|
end
|
100
110
|
|
101
|
-
test 'should complain about length even if
|
111
|
+
test 'should complain about length even if password is not required' do
|
102
112
|
user = new_user(:password => 'x'*129, :password_confirmation => 'x'*129)
|
103
113
|
user.stubs(:password_required?).returns(false)
|
104
114
|
assert user.invalid?
|
data/test/models_test.rb
CHANGED
@@ -1,27 +1,5 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
1
|
require 'test_helper'
|
3
|
-
|
4
|
-
class Configurable < User
|
5
|
-
devise :database_authenticatable, :confirmable, :rememberable, :timeoutable, :lockable,
|
6
|
-
:stretches => 15, :pepper => 'abcdef', :allow_unconfirmed_access_for => 5.days,
|
7
|
-
:remember_for => 7.days, :timeout_in => 15.minutes, :unlock_in => 10.days
|
8
|
-
end
|
9
|
-
|
10
|
-
class WithValidation < Admin
|
11
|
-
devise :database_authenticatable, :validatable, :password_length => 2..6
|
12
|
-
end
|
13
|
-
|
14
|
-
class UserWithValidation < User
|
15
|
-
validates_presence_of :username
|
16
|
-
end
|
17
|
-
|
18
|
-
class Several < Admin
|
19
|
-
devise :validatable
|
20
|
-
devise :lockable
|
21
|
-
end
|
22
|
-
|
23
|
-
class Inheritable < Admin
|
24
|
-
end
|
2
|
+
require 'test_models'
|
25
3
|
|
26
4
|
class ActiveRecordTest < ActiveSupport::TestCase
|
27
5
|
def include_module?(klass, mod)
|
@@ -105,7 +83,12 @@ class ActiveRecordTest < ActiveSupport::TestCase
|
|
105
83
|
end
|
106
84
|
|
107
85
|
test 'set null fields on migrations' do
|
108
|
-
|
86
|
+
# Ignore email sending since no email exists.
|
87
|
+
klass = Class.new(Admin) do
|
88
|
+
def send_devise_notification(*); end
|
89
|
+
end
|
90
|
+
|
91
|
+
klass.create!
|
109
92
|
end
|
110
93
|
end
|
111
94
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
1
|
require 'test_helper'
|
3
2
|
|
4
3
|
class OmniAuthConfigTest < ActiveSupport::TestCase
|
@@ -55,4 +54,4 @@ class OmniAuthConfigTest < ActiveSupport::TestCase
|
|
55
54
|
config_class = config.strategy_class
|
56
55
|
assert_equal MyStrategy, config_class
|
57
56
|
end
|
58
|
-
end
|
57
|
+
end
|
@@ -1,7 +1,9 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
1
|
require 'test_helper'
|
3
2
|
|
4
3
|
class OmniAuthRoutesTest < ActionController::TestCase
|
4
|
+
ExpectedUrlGeneratiorError = Devise.rails4? ?
|
5
|
+
ActionController::UrlGenerationError : ActionController::RoutingError
|
6
|
+
|
5
7
|
tests ApplicationController
|
6
8
|
|
7
9
|
def assert_path(action, provider, with_param=true)
|
@@ -31,7 +33,7 @@ class OmniAuthRoutesTest < ActionController::TestCase
|
|
31
33
|
test 'should generate authorization path' do
|
32
34
|
assert_match "/users/auth/facebook", @controller.omniauth_authorize_path(:user, :facebook)
|
33
35
|
|
34
|
-
assert_raise
|
36
|
+
assert_raise ExpectedUrlGeneratiorError do
|
35
37
|
@controller.omniauth_authorize_path(:user, :github)
|
36
38
|
end
|
37
39
|
end
|
data/test/orm/active_record.rb
CHANGED
data/test/orm/mongoid.rb
CHANGED
@@ -1,15 +1,13 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
1
|
require 'mongoid/version'
|
3
2
|
|
4
3
|
Mongoid.configure do |config|
|
5
|
-
config.
|
4
|
+
config.connect_to("devise-test-suite")
|
6
5
|
config.use_utc = true
|
7
6
|
config.include_root_in_json = true
|
8
7
|
end
|
9
8
|
|
10
9
|
class ActiveSupport::TestCase
|
11
10
|
setup do
|
12
|
-
|
13
|
-
Admin.delete_all
|
11
|
+
Mongoid.purge!
|
14
12
|
end
|
15
13
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'devise/parameter_sanitizer'
|
3
|
+
|
4
|
+
class BaseSanitizerTest < ActiveSupport::TestCase
|
5
|
+
def sanitizer
|
6
|
+
Devise::BaseSanitizer.new(User, :user, { user: { "email" => "jose" } })
|
7
|
+
end
|
8
|
+
|
9
|
+
test 'returns chosen params' do
|
10
|
+
assert_equal({ "email" => "jose" }, sanitizer.for(:sign_in))
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
if defined?(ActionController::StrongParameters)
|
15
|
+
require 'active_model/forbidden_attributes_protection'
|
16
|
+
|
17
|
+
class ParameterSanitizerTest < ActiveSupport::TestCase
|
18
|
+
def sanitizer(params)
|
19
|
+
params = ActionController::Parameters.new(params)
|
20
|
+
Devise::ParameterSanitizer.new(User, :user, params)
|
21
|
+
end
|
22
|
+
|
23
|
+
test 'filters some parameters on sign in by default' do
|
24
|
+
sanitizer = sanitizer(user: { "email" => "jose", "password" => "invalid" })
|
25
|
+
assert_equal({ "email" => "jose" }, sanitizer.for(:sign_in))
|
26
|
+
end
|
27
|
+
|
28
|
+
test 'filters some parameters on sign up by default' do
|
29
|
+
sanitizer = sanitizer(user: { "email" => "jose", "role" => "invalid" })
|
30
|
+
assert_equal({ "email" => "jose" }, sanitizer.for(:sign_up))
|
31
|
+
end
|
32
|
+
|
33
|
+
test 'filters some parameters on account update by default' do
|
34
|
+
sanitizer = sanitizer(user: { "email" => "jose", "role" => "invalid" })
|
35
|
+
assert_equal({ "email" => "jose" }, sanitizer.for(:account_update))
|
36
|
+
end
|
37
|
+
|
38
|
+
test 'allows custom hooks' do
|
39
|
+
sanitizer = sanitizer(user: { "email" => "jose", "password" => "invalid" })
|
40
|
+
sanitizer.for(:sign_in) { |user| user.permit(:email, :password) }
|
41
|
+
assert_equal({ "email" => "jose", "password" => "invalid" }, sanitizer.for(:sign_in))
|
42
|
+
end
|
43
|
+
|
44
|
+
test 'raises on unknown hooks' do
|
45
|
+
sanitizer = sanitizer(user: { "email" => "jose", "password" => "invalid" })
|
46
|
+
assert_raise NotImplementedError do
|
47
|
+
sanitizer.for(:unknown)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
data/test/rails_app/Rakefile
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
1
|
# Filters added to this controller apply to all controllers in the application.
|
3
2
|
# Likewise, all the methods added will be available for all controllers.
|
4
3
|
|
@@ -6,4 +5,5 @@ class ApplicationController < ActionController::Base
|
|
6
5
|
protect_from_forgery
|
7
6
|
before_filter :current_user, :unless => :devise_controller?
|
8
7
|
before_filter :authenticate_user!, :if => :devise_controller?
|
8
|
+
respond_to *Mime::SET.map(&:to_sym)
|
9
9
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
1
|
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
3
2
|
def facebook
|
4
3
|
data = env["omniauth.auth"]
|
@@ -12,4 +11,4 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
|
12
11
|
sign_in user
|
13
12
|
render :text => ""
|
14
13
|
end
|
15
|
-
end
|
14
|
+
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
1
|
class UsersController < ApplicationController
|
3
2
|
prepend_before_filter :current_user, :only => :exhibit
|
4
3
|
before_filter :authenticate_user!, :except => [:accept, :exhibit]
|
@@ -9,6 +8,14 @@ class UsersController < ApplicationController
|
|
9
8
|
respond_with(current_user)
|
10
9
|
end
|
11
10
|
|
11
|
+
def edit_form
|
12
|
+
user_session['last_request_at'] = 31.minutes.ago.utc
|
13
|
+
end
|
14
|
+
|
15
|
+
def update_form
|
16
|
+
render :text => 'Update'
|
17
|
+
end
|
18
|
+
|
12
19
|
def accept
|
13
20
|
@current_user = current_user
|
14
21
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
1
|
class Users::Mailer < Devise::Mailer
|
3
2
|
default :from => 'custom@example.com'
|
4
3
|
end
|
@@ -7,3 +6,7 @@ class Users::ReplyToMailer < Devise::Mailer
|
|
7
6
|
default :from => 'custom@example.com'
|
8
7
|
default :reply_to => 'custom_reply_to@example.com'
|
9
8
|
end
|
9
|
+
|
10
|
+
class Users::FromProcMailer < Devise::Mailer
|
11
|
+
default :from => proc { 'custom@example.com' }
|
12
|
+
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
1
|
require 'shared_admin'
|
3
2
|
|
4
3
|
class Admin
|
@@ -7,8 +6,8 @@ class Admin
|
|
7
6
|
include SharedAdmin
|
8
7
|
|
9
8
|
## Database authenticatable
|
10
|
-
field :email, :type => String
|
11
|
-
field :encrypted_password, :type => String
|
9
|
+
field :email, :type => String
|
10
|
+
field :encrypted_password, :type => String
|
12
11
|
|
13
12
|
## Recoverable
|
14
13
|
field :reset_password_token, :type => String
|
@@ -25,4 +24,6 @@ class Admin
|
|
25
24
|
|
26
25
|
## Lockable
|
27
26
|
field :locked_at, :type => Time
|
27
|
+
|
28
|
+
field :active, :type => Boolean, :default => false
|
28
29
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
1
|
module Shim
|
3
2
|
extend ::ActiveSupport::Concern
|
4
3
|
|
@@ -8,13 +7,12 @@ module Shim
|
|
8
7
|
end
|
9
8
|
|
10
9
|
module ClassMethods
|
11
|
-
def
|
12
|
-
|
13
|
-
super(options)
|
10
|
+
def order(attribute)
|
11
|
+
asc(attribute)
|
14
12
|
end
|
15
13
|
|
16
14
|
def find_by_email(email)
|
17
|
-
|
15
|
+
find_by(:email => email)
|
18
16
|
end
|
19
17
|
end
|
20
18
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
1
|
require 'shared_user'
|
3
2
|
|
4
3
|
class User
|
@@ -10,8 +9,8 @@ class User
|
|
10
9
|
field :facebook_token, :type => String
|
11
10
|
|
12
11
|
## Database authenticatable
|
13
|
-
field :email, :type => String, :
|
14
|
-
field :encrypted_password, :type => String, :
|
12
|
+
field :email, :type => String, :default => ""
|
13
|
+
field :encrypted_password, :type => String, :default => ""
|
15
14
|
|
16
15
|
## Recoverable
|
17
16
|
field :reset_password_token, :type => String
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= button_to 'Update', update_form_user_path(current_user), method: 'put' %>
|
@@ -1,9 +1,7 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
1
|
require File.expand_path('../boot', __FILE__)
|
3
2
|
|
4
3
|
require "action_controller/railtie"
|
5
4
|
require "action_mailer/railtie"
|
6
|
-
require "active_resource/railtie"
|
7
5
|
require "rails/test_unit/railtie"
|
8
6
|
|
9
7
|
Bundler.require :default, DEVISE_ORM
|
@@ -18,7 +16,7 @@ require "devise"
|
|
18
16
|
module RailsApp
|
19
17
|
class Application < Rails::Application
|
20
18
|
# Add additional load paths for your own custom dirs
|
21
|
-
config.autoload_paths.reject!{ |p| p =~ /\/app\/(\w+)$/ && !%w(controllers helpers views).include?($1) }
|
19
|
+
config.autoload_paths.reject!{ |p| p =~ /\/app\/(\w+)$/ && !%w(controllers helpers mailers views).include?($1) }
|
22
20
|
config.autoload_paths += [ "#{config.root}/app/#{DEVISE_ORM}" ]
|
23
21
|
|
24
22
|
# Configure generators values. Many other options are available, be sure to check the documentation.
|