sorcery 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sorcery might be problematic. Click here for more details.

Files changed (164) hide show
  1. data/Gemfile +2 -1
  2. data/Gemfile.lock +58 -51
  3. data/README.rdoc +19 -57
  4. data/Rakefile +27 -1
  5. data/VERSION +1 -1
  6. data/lib/generators/sorcery/USAGE +22 -0
  7. data/lib/generators/sorcery/install_generator.rb +71 -0
  8. data/lib/{sorcery/initializers → generators/sorcery/templates}/initializer.rb +4 -4
  9. data/lib/generators/sorcery/templates/migration/activity_logging.rb +17 -0
  10. data/lib/generators/sorcery/templates/migration/brute_force_protection.rb +11 -0
  11. data/lib/generators/{sorcery_migration/templates → sorcery/templates/migration}/core.rb +2 -2
  12. data/lib/generators/{sorcery_migration/templates → sorcery/templates/migration}/external.rb +1 -1
  13. data/lib/generators/sorcery/templates/migration/remember_me.rb +15 -0
  14. data/lib/generators/sorcery/templates/migration/reset_password.rb +17 -0
  15. data/lib/generators/sorcery/templates/migration/user_activation.rb +17 -0
  16. data/lib/sorcery.rb +5 -7
  17. data/lib/sorcery/controller.rb +40 -39
  18. data/lib/sorcery/controller/submodules/activity_logging.rb +7 -10
  19. data/lib/sorcery/controller/submodules/external/protocols/oauth2.rb +23 -8
  20. data/lib/sorcery/controller/submodules/remember_me.rb +3 -2
  21. data/lib/sorcery/model.rb +21 -4
  22. data/lib/sorcery/model/adapters/mongo_mapper.rb +49 -0
  23. data/lib/sorcery/model/adapters/mongoid.rb +1 -1
  24. data/lib/sorcery/model/submodules/brute_force_protection.rb +8 -0
  25. data/lib/sorcery/model/submodules/remember_me.rb +8 -1
  26. data/lib/sorcery/model/submodules/reset_password.rb +10 -0
  27. data/lib/sorcery/model/submodules/user_activation.rb +12 -0
  28. data/sorcery.gemspec +86 -210
  29. data/spec/Gemfile +1 -1
  30. data/spec/Gemfile.lock +28 -15
  31. data/spec/README.md +6 -1
  32. data/spec/rails3/Gemfile +2 -2
  33. data/spec/rails3/Gemfile.lock +45 -50
  34. data/spec/rails3/spec/controller_oauth2_spec.rb +5 -3
  35. data/spec/rails3/spec/spec_helper.rb +1 -3
  36. data/spec/rails3_mongo_mapper/.gitignore +4 -0
  37. data/spec/rails3_mongo_mapper/.rspec +1 -0
  38. data/spec/{sinatra_modular → rails3_mongo_mapper}/Gemfile +5 -5
  39. data/spec/rails3_mongo_mapper/Gemfile.lock +159 -0
  40. data/spec/{sinatra → rails3_mongo_mapper}/Rakefile +3 -3
  41. data/spec/rails3_mongo_mapper/app/controllers/application_controller.rb +108 -0
  42. data/spec/rails3_mongo_mapper/app/helpers/application_helper.rb +2 -0
  43. data/spec/{sinatra → rails3_mongo_mapper/app/mailers}/sorcery_mailer.rb +0 -0
  44. data/spec/rails3_mongo_mapper/app/models/authentication.rb +6 -0
  45. data/spec/rails3_mongo_mapper/app/models/user.rb +5 -0
  46. data/spec/rails3_mongo_mapper/app/views/layouts/application.html.erb +14 -0
  47. data/spec/rails3_mongo_mapper/app/views/sorcery_mailer/activation_email.html.erb +17 -0
  48. data/spec/rails3_mongo_mapper/app/views/sorcery_mailer/activation_email.text.erb +9 -0
  49. data/spec/rails3_mongo_mapper/app/views/sorcery_mailer/activation_success_email.html.erb +17 -0
  50. data/spec/rails3_mongo_mapper/app/views/sorcery_mailer/activation_success_email.text.erb +9 -0
  51. data/spec/rails3_mongo_mapper/app/views/sorcery_mailer/reset_password_email.html.erb +16 -0
  52. data/spec/rails3_mongo_mapper/app/views/sorcery_mailer/reset_password_email.text.erb +8 -0
  53. data/spec/rails3_mongo_mapper/config.ru +4 -0
  54. data/spec/rails3_mongo_mapper/config/application.rb +51 -0
  55. data/spec/rails3_mongo_mapper/config/boot.rb +13 -0
  56. data/spec/rails3_mongo_mapper/config/environment.rb +5 -0
  57. data/spec/rails3_mongo_mapper/config/environments/development.rb +30 -0
  58. data/spec/rails3_mongo_mapper/config/environments/in_memory.rb +0 -0
  59. data/spec/rails3_mongo_mapper/config/environments/production.rb +49 -0
  60. data/spec/rails3_mongo_mapper/config/environments/test.rb +35 -0
  61. data/spec/rails3_mongo_mapper/config/initializers/backtrace_silencers.rb +7 -0
  62. data/spec/rails3_mongo_mapper/config/initializers/inflections.rb +10 -0
  63. data/spec/rails3_mongo_mapper/config/initializers/mime_types.rb +5 -0
  64. data/spec/rails3_mongo_mapper/config/initializers/mongo.rb +2 -0
  65. data/spec/rails3_mongo_mapper/config/initializers/secret_token.rb +7 -0
  66. data/spec/rails3_mongo_mapper/config/initializers/session_store.rb +8 -0
  67. data/spec/rails3_mongo_mapper/config/locales/en.yml +5 -0
  68. data/spec/rails3_mongo_mapper/config/routes.rb +59 -0
  69. data/spec/rails3_mongo_mapper/db/schema.rb +23 -0
  70. data/spec/rails3_mongo_mapper/db/seeds.rb +7 -0
  71. data/spec/rails3_mongo_mapper/lib/tasks/.gitkeep +0 -0
  72. data/spec/rails3_mongo_mapper/public/404.html +26 -0
  73. data/spec/rails3_mongo_mapper/public/422.html +26 -0
  74. data/spec/rails3_mongo_mapper/public/500.html +26 -0
  75. data/spec/rails3_mongo_mapper/public/favicon.ico +0 -0
  76. data/spec/rails3_mongo_mapper/public/images/rails.png +0 -0
  77. data/spec/rails3_mongo_mapper/public/javascripts/application.js +2 -0
  78. data/spec/rails3_mongo_mapper/public/javascripts/controls.js +965 -0
  79. data/spec/rails3_mongo_mapper/public/javascripts/dragdrop.js +974 -0
  80. data/spec/rails3_mongo_mapper/public/javascripts/effects.js +1123 -0
  81. data/spec/rails3_mongo_mapper/public/javascripts/prototype.js +6001 -0
  82. data/spec/rails3_mongo_mapper/public/javascripts/rails.js +175 -0
  83. data/spec/rails3_mongo_mapper/public/robots.txt +5 -0
  84. data/spec/rails3_mongo_mapper/public/stylesheets/.gitkeep +0 -0
  85. data/spec/rails3_mongo_mapper/script/rails +6 -0
  86. data/spec/{sinatra → rails3_mongo_mapper}/spec/controller_spec.rb +45 -42
  87. data/spec/{sinatra → rails3_mongo_mapper}/spec/spec.opts +0 -0
  88. data/spec/rails3_mongo_mapper/spec/spec_helper.orig.rb +27 -0
  89. data/spec/rails3_mongo_mapper/spec/spec_helper.rb +55 -0
  90. data/spec/rails3_mongo_mapper/spec/user_activation_spec.rb +9 -0
  91. data/spec/rails3_mongo_mapper/spec/user_activity_logging_spec.rb +8 -0
  92. data/spec/rails3_mongo_mapper/spec/user_brute_force_protection_spec.rb +8 -0
  93. data/spec/rails3_mongo_mapper/spec/user_oauth_spec.rb +8 -0
  94. data/spec/rails3_mongo_mapper/spec/user_remember_me_spec.rb +8 -0
  95. data/spec/rails3_mongo_mapper/spec/user_reset_password_spec.rb +8 -0
  96. data/spec/rails3_mongo_mapper/spec/user_spec.rb +37 -0
  97. data/spec/rails3_mongo_mapper/vendor/plugins/.gitkeep +0 -0
  98. data/spec/rails3_mongoid/Gemfile +1 -1
  99. data/spec/rails3_mongoid/Gemfile.lock +44 -35
  100. data/spec/rails3_mongoid/spec/controller_activity_logging_spec.rb +98 -0
  101. data/spec/rails3_mongoid/spec/user_spec.rb +1 -0
  102. data/spec/shared_examples/user_shared_examples.rb +29 -1
  103. metadata +124 -237
  104. data/lib/generators/sorcery_migration/sorcery_migration_generator.rb +0 -24
  105. data/lib/generators/sorcery_migration/templates/activity_logging.rb +0 -17
  106. data/lib/generators/sorcery_migration/templates/brute_force_protection.rb +0 -11
  107. data/lib/generators/sorcery_migration/templates/remember_me.rb +0 -15
  108. data/lib/generators/sorcery_migration/templates/reset_password.rb +0 -17
  109. data/lib/generators/sorcery_migration/templates/user_activation.rb +0 -17
  110. data/lib/sorcery/controller/adapters/sinatra.rb +0 -115
  111. data/lib/sorcery/sinatra.rb +0 -4
  112. data/lib/sorcery/test_helpers/internal/sinatra.rb +0 -74
  113. data/lib/sorcery/test_helpers/internal/sinatra_modular.rb +0 -74
  114. data/lib/sorcery/test_helpers/sinatra.rb +0 -88
  115. data/spec/rails3/Rakefile.unused +0 -7
  116. data/spec/sinatra/Gemfile +0 -15
  117. data/spec/sinatra/Gemfile.lock +0 -115
  118. data/spec/sinatra/authentication.rb +0 -3
  119. data/spec/sinatra/db/migrate/activation/20101224223622_add_activation_to_users.rb +0 -17
  120. data/spec/sinatra/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb +0 -17
  121. data/spec/sinatra/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb +0 -11
  122. data/spec/sinatra/db/migrate/core/20101224223620_create_users.rb +0 -16
  123. data/spec/sinatra/db/migrate/external/20101224223628_create_authentications.rb +0 -14
  124. data/spec/sinatra/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb +0 -15
  125. data/spec/sinatra/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb +0 -13
  126. data/spec/sinatra/filters.rb +0 -27
  127. data/spec/sinatra/modular.rb +0 -157
  128. data/spec/sinatra/myapp.rb +0 -133
  129. data/spec/sinatra/spec/controller_activity_logging_spec.rb +0 -85
  130. data/spec/sinatra/spec/controller_brute_force_protection_spec.rb +0 -70
  131. data/spec/sinatra/spec/controller_http_basic_auth_spec.rb +0 -53
  132. data/spec/sinatra/spec/controller_oauth2_spec.rb +0 -96
  133. data/spec/sinatra/spec/controller_oauth_spec.rb +0 -100
  134. data/spec/sinatra/spec/controller_remember_me_spec.rb +0 -64
  135. data/spec/sinatra/spec/controller_session_timeout_spec.rb +0 -57
  136. data/spec/sinatra/spec/spec_helper.rb +0 -45
  137. data/spec/sinatra/user.rb +0 -6
  138. data/spec/sinatra/views/test_login.erb +0 -4
  139. data/spec/sinatra_modular/Gemfile.lock +0 -115
  140. data/spec/sinatra_modular/Rakefile +0 -11
  141. data/spec/sinatra_modular/authentication.rb +0 -3
  142. data/spec/sinatra_modular/db/migrate/activation/20101224223622_add_activation_to_users.rb +0 -17
  143. data/spec/sinatra_modular/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb +0 -17
  144. data/spec/sinatra_modular/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb +0 -11
  145. data/spec/sinatra_modular/db/migrate/core/20101224223620_create_users.rb +0 -16
  146. data/spec/sinatra_modular/db/migrate/external/20101224223628_create_authentications.rb +0 -14
  147. data/spec/sinatra_modular/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb +0 -15
  148. data/spec/sinatra_modular/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb +0 -13
  149. data/spec/sinatra_modular/filters.rb +0 -27
  150. data/spec/sinatra_modular/modular.rb +0 -157
  151. data/spec/sinatra_modular/myapp.rb +0 -133
  152. data/spec/sinatra_modular/sorcery_mailer.rb +0 -25
  153. data/spec/sinatra_modular/spec_modular/controller_activity_logging_spec.rb +0 -85
  154. data/spec/sinatra_modular/spec_modular/controller_brute_force_protection_spec.rb +0 -70
  155. data/spec/sinatra_modular/spec_modular/controller_http_basic_auth_spec.rb +0 -53
  156. data/spec/sinatra_modular/spec_modular/controller_oauth2_spec.rb +0 -96
  157. data/spec/sinatra_modular/spec_modular/controller_oauth_spec.rb +0 -100
  158. data/spec/sinatra_modular/spec_modular/controller_remember_me_spec.rb +0 -64
  159. data/spec/sinatra_modular/spec_modular/controller_session_timeout_spec.rb +0 -57
  160. data/spec/sinatra_modular/spec_modular/controller_spec.rb +0 -116
  161. data/spec/sinatra_modular/spec_modular/spec.opts +0 -2
  162. data/spec/sinatra_modular/spec_modular/spec_helper.rb +0 -51
  163. data/spec/sinatra_modular/user.rb +0 -6
  164. data/spec/sinatra_modular/views/test_login.erb +0 -4
@@ -1,64 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
-
3
- describe Sinatra::Application do
4
-
5
- # ----------------- REMEMBER ME -----------------------
6
- describe Sinatra::Application, "with remember me features" do
7
- before(:all) do
8
- ActiveRecord::Migrator.migrate("#{APP_ROOT}/db/migrate/remember_me")
9
- sorcery_reload!([:remember_me])
10
- end
11
-
12
- before(:each) do
13
- create_new_user
14
- end
15
-
16
- after(:all) do
17
- ActiveRecord::Migrator.rollback("#{APP_ROOT}/db/migrate/remember_me")
18
- end
19
-
20
- after(:each) do
21
- session = nil
22
- clear_cookies
23
- User.delete_all
24
- end
25
-
26
- it "should set cookie on remember_me!" do
27
- post "/test_login_with_remember", :username => 'gizmo', :password => 'secret'
28
- cookies["remember_me_token"].should == assigns[:user].remember_me_token
29
- end
30
-
31
- it "should clear cookie on forget_me!" do
32
- cookies["remember_me_token"] == {:value => 'asd54234dsfsd43534', :expires => 3600}
33
- get '/test_logout'
34
- cookies["remember_me_token"].should == nil
35
- end
36
-
37
- it "login(username,password,remember_me) should login and remember" do
38
- post '/test_login_with_remember_in_login', :username => 'gizmo', :password => 'secret', :remember => "1"
39
- cookies["remember_me_token"].should_not be_nil
40
- cookies["remember_me_token"].should == assigns[:user].remember_me_token
41
- end
42
-
43
- it "logout should also forget_me!" do
44
- session[:user_id] = @user.id
45
- get '/test_logout_with_remember'
46
- cookies["remember_me_token"].should == nil
47
- end
48
-
49
- it "should login_from_cookie" do
50
- post "/test_login_with_remember", :username => 'gizmo', :password => 'secret'
51
- get_sinatra_app(subject).instance_eval do
52
- @current_user = nil
53
- end
54
- session[:user_id] = nil
55
- get '/test_login_from_cookie'
56
- assigns[:current_user].should == @user
57
- end
58
-
59
- it "should not remember_me! when not asked to" do
60
- post '/test_login', :username => 'gizmo', :password => 'secret'
61
- cookies["remember_me_token"].should == nil
62
- end
63
- end
64
- end
@@ -1,57 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
-
3
- describe Sinatra::Application do
4
-
5
- # ----------------- SESSION TIMEOUT -----------------------
6
- describe Sinatra::Application, "with session timeout features" do
7
- before(:all) do
8
- sorcery_reload!([:session_timeout])
9
- sorcery_controller_property_set(:session_timeout,0.5)
10
- create_new_user
11
- end
12
-
13
- after(:each) do
14
- Timecop.return
15
- end
16
-
17
- it "should not reset session before session timeout" do
18
- session[:user_id] = User.first.id
19
- get "/test_should_be_logged_in"
20
- last_response.should be_ok
21
- end
22
-
23
- it "should reset session after session timeout" do
24
- get "/test_login", :username => 'gizmo', :password => 'secret'
25
- session[:user_id].should_not be_nil
26
- Timecop.travel(Time.now+0.6)
27
- get "/test_should_be_logged_in"
28
- last_response.should be_a_redirect
29
- end
30
-
31
- context "with 'session_timeout_from_last_action'" do
32
- it "should not logout if there was activity" do
33
- session[:user_id] = nil
34
- sorcery_controller_property_set(:session_timeout,2)
35
- sorcery_controller_property_set(:session_timeout_from_last_action, true)
36
- get "/test_login", :username => 'gizmo', :password => 'secret'
37
- Timecop.travel(Time.now+1)
38
- get "/test_should_be_logged_in"
39
- session[:user_id].should_not be_nil
40
- Timecop.travel(Time.now+1)
41
- get "/test_should_be_logged_in"
42
- session[:user_id].should_not be_nil
43
- last_response.should be_ok
44
- end
45
-
46
- it "should logout if there was no activity" do
47
- sorcery_controller_property_set(:session_timeout,0.5)
48
- sorcery_controller_property_set(:session_timeout_from_last_action, true)
49
- get "/test_login", :username => 'gizmo', :password => 'secret'
50
- Timecop.travel(Time.now+0.6)
51
- get "/test_should_be_logged_in"
52
- session[:user_id].should be_nil
53
- last_response.should be_a_redirect
54
- end
55
- end
56
- end
57
- end
@@ -1,45 +0,0 @@
1
- require File.join(File.dirname(__FILE__), '..', 'myapp.rb')
2
- $: << APP_ROOT # for model reloading
3
-
4
- require 'rack/test'
5
- require 'rspec'
6
- require 'timecop'
7
-
8
- # set test environment
9
- set :environment, :test
10
- set :run, false
11
- set :raise_errors, true
12
- set :logging, false
13
-
14
- module RSpecMixinExample
15
- include Rack::Test::Methods
16
- def app
17
- @app ||= Sinatra::Application
18
- end
19
- end
20
-
21
- Rspec.configure do |config|
22
- config.send(:include, RSpecMixinExample)
23
- config.send(:include, ::Sorcery::TestHelpers::Internal)
24
- config.send(:include, ::Sorcery::TestHelpers::Internal::Sinatra)
25
- config.before(:suite) do
26
- ActiveRecord::Migrator.migrate("#{APP_ROOT}/db/migrate/core")
27
- end
28
-
29
- config.after(:suite) do
30
- ActiveRecord::Migrator.rollback("#{APP_ROOT}/db/migrate/core")
31
- end
32
-
33
- end
34
-
35
- # needed when running individual specs
36
- require File.join(File.dirname(__FILE__), '..','user')
37
- require File.join(File.dirname(__FILE__), '..','authentication')
38
-
39
- class TestUser < ActiveRecord::Base
40
- authenticates_with_sorcery!
41
- end
42
-
43
- class TestMailer < ActionMailer::Base
44
-
45
- end
data/spec/sinatra/user.rb DELETED
@@ -1,6 +0,0 @@
1
- class User < ActiveRecord::Base
2
- attr_accessible :email, :password, :password_confirmation, :authentications_attributes
3
-
4
- has_many :authentications, :dependent => :destroy
5
- accepts_nested_attributes_for :authentications
6
- end
@@ -1,4 +0,0 @@
1
- <%= @user %> bla bla
2
-
3
- hourdyasd
4
- <bla>
@@ -1,115 +0,0 @@
1
- PATH
2
- remote: ../../
3
- specs:
4
- sorcery (0.6.1)
5
- bcrypt-ruby (~> 3.0.0)
6
- oauth (~> 0.4.4)
7
- oauth2 (~> 0.5.0)
8
-
9
- GEM
10
- remote: http://rubygems.org/
11
- specs:
12
- abstract (1.0.0)
13
- actionmailer (3.0.5)
14
- actionpack (= 3.0.5)
15
- mail (~> 2.2.15)
16
- actionpack (3.0.5)
17
- activemodel (= 3.0.5)
18
- activesupport (= 3.0.5)
19
- builder (~> 2.1.2)
20
- erubis (~> 2.6.6)
21
- i18n (~> 0.4)
22
- rack (~> 1.2.1)
23
- rack-mount (~> 0.6.13)
24
- rack-test (~> 0.5.7)
25
- tzinfo (~> 0.3.23)
26
- activemodel (3.0.5)
27
- activesupport (= 3.0.5)
28
- builder (~> 2.1.2)
29
- i18n (~> 0.4)
30
- activerecord (3.0.5)
31
- activemodel (= 3.0.5)
32
- activesupport (= 3.0.5)
33
- arel (~> 2.0.2)
34
- tzinfo (~> 0.3.23)
35
- activesupport (3.0.5)
36
- addressable (2.2.6)
37
- archive-tar-minitar (0.5.2)
38
- arel (2.0.7)
39
- bcrypt-ruby (3.0.1)
40
- builder (2.1.2)
41
- columnize (0.3.2)
42
- diff-lcs (1.1.2)
43
- erubis (2.6.6)
44
- abstract (>= 1.0.0)
45
- faraday (0.7.4)
46
- addressable (~> 2.2.6)
47
- multipart-post (~> 1.1.0)
48
- rack (< 2, >= 1.1.0)
49
- i18n (0.5.0)
50
- linecache19 (0.5.11)
51
- ruby_core_source (>= 0.1.4)
52
- mail (2.2.15)
53
- activesupport (>= 2.3.6)
54
- i18n (>= 0.4.0)
55
- mime-types (~> 1.16)
56
- treetop (~> 1.4.8)
57
- mime-types (1.16)
58
- multi_json (1.0.3)
59
- multipart-post (1.1.3)
60
- oauth (0.4.5)
61
- oauth2 (0.5.1)
62
- faraday (~> 0.7.4)
63
- multi_json (~> 1.0.3)
64
- polyglot (0.3.1)
65
- rack (1.2.1)
66
- rack-mount (0.6.14)
67
- rack (>= 1.0.0)
68
- rack-test (0.5.7)
69
- rack (>= 1.0)
70
- rake (0.8.7)
71
- rspec (2.5.0)
72
- rspec-core (~> 2.5.0)
73
- rspec-expectations (~> 2.5.0)
74
- rspec-mocks (~> 2.5.0)
75
- rspec-core (2.5.1)
76
- rspec-expectations (2.5.0)
77
- diff-lcs (~> 1.1.2)
78
- rspec-mocks (2.5.0)
79
- ruby-debug-base19 (0.11.24)
80
- columnize (>= 0.3.1)
81
- linecache19 (>= 0.5.11)
82
- ruby_core_source (>= 0.1.4)
83
- ruby-debug19 (0.11.6)
84
- columnize (>= 0.3.1)
85
- linecache19 (>= 0.5.11)
86
- ruby-debug-base19 (>= 0.11.19)
87
- ruby_core_source (0.1.4)
88
- archive-tar-minitar (>= 0.5.2)
89
- simplecov (0.3.9)
90
- simplecov-html (>= 0.3.7)
91
- simplecov-html (0.3.9)
92
- sinatra (1.2.0)
93
- rack (~> 1.1)
94
- tilt (< 2.0, >= 1.2.2)
95
- sqlite3-ruby (1.3.2)
96
- tilt (1.2.2)
97
- timecop (0.3.5)
98
- treetop (1.4.9)
99
- polyglot (>= 0.3.1)
100
- tzinfo (0.3.24)
101
-
102
- PLATFORMS
103
- ruby
104
-
105
- DEPENDENCIES
106
- actionmailer (>= 3.0.3)
107
- activerecord (>= 3.0.3)
108
- rake
109
- rspec (~> 2.5.0)
110
- ruby-debug19
111
- simplecov (>= 0.3.8)
112
- sinatra (>= 1.2.0)
113
- sorcery (>= 0.1.0)!
114
- sqlite3-ruby
115
- timecop
@@ -1,11 +0,0 @@
1
- require 'rake'
2
- require 'rspec/core/rake_task'
3
-
4
- desc 'Default: Run all specs.'
5
- task :default => :spec
6
-
7
- desc "Run all specs"
8
- RSpec::Core::RakeTask.new(:spec) do |t|
9
- t.pattern = 'spec_modular/*_spec.rb'
10
- t.rspec_opts = ["--options #{File.dirname(__FILE__)}/spec_modular/spec.opts"]
11
- end
@@ -1,3 +0,0 @@
1
- class Authentication < ActiveRecord::Base
2
- belongs_to :user
3
- end
@@ -1,17 +0,0 @@
1
- class AddActivationToUsers < ActiveRecord::Migration
2
- def self.up
3
- add_column :users, :activation_state, :string, :default => nil
4
- add_column :users, :activation_token, :string, :default => nil
5
- add_column :users, :activation_token_expires_at, :datetime, :default => nil
6
-
7
- add_index :users, :activation_token
8
- end
9
-
10
- def self.down
11
- remove_index :users, :activation_token
12
-
13
- remove_column :users, :activation_token_expires_at
14
- remove_column :users, :activation_token
15
- remove_column :users, :activation_state
16
- end
17
- end
@@ -1,17 +0,0 @@
1
- class AddActivityLoggingToUsers < ActiveRecord::Migration
2
- def self.up
3
- add_column :users, :last_login_at, :datetime, :default => nil
4
- add_column :users, :last_logout_at, :datetime, :default => nil
5
- add_column :users, :last_activity_at, :datetime, :default => nil
6
-
7
- add_index :users, [:last_logout_at, :last_activity_at]
8
- end
9
-
10
- def self.down
11
- remove_index :users, [:last_logout_at, :last_activity_at]
12
-
13
- remove_column :users, :last_activity_at
14
- remove_column :users, :last_logout_at
15
- remove_column :users, :last_login_at
16
- end
17
- end
@@ -1,11 +0,0 @@
1
- class AddBruteForceProtectionToUsers < ActiveRecord::Migration
2
- def self.up
3
- add_column :users, :failed_logins_count, :integer, :default => 0
4
- add_column :users, :lock_expires_at, :datetime, :default => nil
5
- end
6
-
7
- def self.down
8
- remove_column :users, :lock_expires_at
9
- remove_column :users, :failed_logins_count
10
- end
11
- end
@@ -1,16 +0,0 @@
1
- class CreateUsers < ActiveRecord::Migration
2
- def self.up
3
- create_table :users do |t|
4
- t.string :username, :null => false
5
- t.string :email, :default => nil
6
- t.string :crypted_password, :default => nil
7
- t.string :salt, :default => nil
8
-
9
- t.timestamps
10
- end
11
- end
12
-
13
- def self.down
14
- drop_table :users
15
- end
16
- end
@@ -1,14 +0,0 @@
1
- class CreateAuthentications < ActiveRecord::Migration
2
- def self.up
3
- create_table :authentications do |t|
4
- t.integer :user_id, :null => false
5
- t.string :provider, :uid, :null => false
6
-
7
- t.timestamps
8
- end
9
- end
10
-
11
- def self.down
12
- drop_table :authentications
13
- end
14
- end
@@ -1,15 +0,0 @@
1
- class AddRememberMeTokenToUsers < ActiveRecord::Migration
2
- def self.up
3
- add_column :users, :remember_me_token, :string, :default => nil
4
- add_column :users, :remember_me_token_expires_at, :datetime, :default => nil
5
-
6
- add_index :users, :remember_me_token
7
- end
8
-
9
- def self.down
10
- remove_index :users, :remember_me_token
11
-
12
- remove_column :users, :remember_me_token_expires_at
13
- remove_column :users, :remember_me_token
14
- end
15
- end
@@ -1,13 +0,0 @@
1
- class AddResetPasswordToUsers < ActiveRecord::Migration
2
- def self.up
3
- add_column :users, :reset_password_token, :string, :default => nil
4
- add_column :users, :reset_password_token_expires_at, :datetime, :default => nil
5
- add_column :users, :reset_password_email_sent_at, :datetime, :default => nil
6
- end
7
-
8
- def self.down
9
- remove_column :users, :reset_password_email_sent_at
10
- remove_column :users, :reset_password_token_expires_at
11
- remove_column :users, :reset_password_token
12
- end
13
- end
@@ -1,27 +0,0 @@
1
- # --- before filters
2
- module Filters
3
-
4
- def self.included(klass)
5
- klass.class_eval do
6
- ['/test_logout', '/some_action', '/test_should_be_logged_in'].each do |pattern|
7
- before pattern do
8
- require_login
9
- end
10
- end
11
-
12
- before '/test_http_basic_auth' do
13
- require_login_from_http_basic
14
- end
15
-
16
- # ----- test filters
17
-
18
- before do
19
- self.class.sorcery_vars = {}
20
- end
21
-
22
- after do
23
- save_instance_vars
24
- end
25
- end
26
- end
27
- end