sorcery 0.6.1 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +1 -0
- data/Gemfile.lock +52 -45
- data/README.rdoc +26 -54
- data/Rakefile +26 -0
- data/VERSION +1 -1
- data/lib/generators/sorcery/USAGE +22 -0
- data/lib/generators/sorcery/install_generator.rb +71 -0
- data/lib/{sorcery/initializers → generators/sorcery/templates}/initializer.rb +82 -61
- data/lib/generators/sorcery/templates/migration/activity_logging.rb +17 -0
- data/lib/generators/sorcery/templates/migration/brute_force_protection.rb +11 -0
- data/lib/generators/{sorcery_migration/templates → sorcery/templates/migration}/core.rb +3 -3
- data/lib/generators/{sorcery_migration/templates → sorcery/templates/migration}/external.rb +1 -1
- data/lib/generators/sorcery/templates/migration/remember_me.rb +15 -0
- data/lib/generators/sorcery/templates/migration/reset_password.rb +17 -0
- data/lib/generators/sorcery/templates/migration/user_activation.rb +17 -0
- data/lib/sorcery/controller/submodules/activity_logging.rb +23 -9
- data/lib/sorcery/controller/submodules/brute_force_protection.rb +2 -1
- data/lib/sorcery/controller/submodules/external/protocols/certs/ca-bundle.crt +5182 -0
- data/lib/sorcery/controller/submodules/external/protocols/oauth2.rb +27 -8
- data/lib/sorcery/controller/submodules/external/providers/github.rb +80 -0
- data/lib/sorcery/controller/submodules/external/providers/twitter.rb +5 -0
- data/lib/sorcery/controller/submodules/external.rb +10 -3
- data/lib/sorcery/controller/submodules/http_basic_auth.rb +1 -1
- data/lib/sorcery/controller/submodules/remember_me.rb +15 -5
- data/lib/sorcery/controller/submodules/session_timeout.rb +1 -1
- data/lib/sorcery/controller.rb +59 -38
- data/lib/sorcery/crypto_providers/aes256.rb +7 -3
- data/lib/sorcery/engine.rb +1 -0
- data/lib/sorcery/model/adapters/active_record.rb +2 -1
- data/lib/sorcery/model/adapters/mongo_mapper.rb +49 -0
- data/lib/sorcery/model/adapters/mongoid.rb +7 -2
- data/lib/sorcery/model/submodules/brute_force_protection.rb +13 -3
- data/lib/sorcery/model/submodules/remember_me.rb +9 -2
- data/lib/sorcery/model/submodules/reset_password.rb +11 -2
- data/lib/sorcery/model/submodules/user_activation.rb +13 -2
- data/lib/sorcery/model/temporary_token.rb +5 -0
- data/lib/sorcery/model.rb +34 -15
- data/lib/sorcery/test_helpers/internal/rails.rb +1 -1
- data/lib/sorcery/test_helpers/rails.rb +2 -2
- data/lib/sorcery.rb +6 -7
- data/sorcery.gemspec +86 -203
- data/spec/Gemfile.lock +23 -12
- data/spec/README.md +31 -0
- data/spec/rails3/Gemfile +3 -1
- data/spec/rails3/Gemfile.lock +45 -28
- data/spec/rails3/app/controllers/application_controller.rb +40 -22
- data/spec/rails3/app/views/application/index.html.erb +17 -0
- data/spec/rails3/spec/controller_activity_logging_spec.rb +23 -0
- data/spec/rails3/spec/controller_oauth2_spec.rb +59 -16
- data/spec/rails3/spec/controller_remember_me_spec.rb +37 -6
- data/spec/rails3/spec/controller_spec.rb +30 -0
- data/spec/rails3/spec/integration_spec.rb +23 -0
- data/spec/rails3/spec/spec_helper.rb +6 -5
- data/spec/rails3_mongo_mapper/.gitignore +4 -0
- data/spec/rails3_mongo_mapper/.rspec +1 -0
- data/spec/{sinatra_modular → rails3_mongo_mapper}/Gemfile +5 -5
- data/spec/rails3_mongo_mapper/Gemfile.lock +159 -0
- data/spec/{sinatra → rails3_mongo_mapper}/Rakefile +3 -3
- data/spec/rails3_mongo_mapper/app/controllers/application_controller.rb +108 -0
- data/spec/rails3_mongo_mapper/app/helpers/application_helper.rb +2 -0
- data/spec/rails3_mongo_mapper/app/models/authentication.rb +6 -0
- data/spec/rails3_mongo_mapper/app/models/user.rb +5 -0
- data/spec/rails3_mongo_mapper/app/views/layouts/application.html.erb +14 -0
- data/spec/rails3_mongo_mapper/app/views/sorcery_mailer/activation_email.html.erb +17 -0
- data/spec/rails3_mongo_mapper/app/views/sorcery_mailer/activation_email.text.erb +9 -0
- data/spec/rails3_mongo_mapper/app/views/sorcery_mailer/activation_success_email.html.erb +17 -0
- data/spec/rails3_mongo_mapper/app/views/sorcery_mailer/activation_success_email.text.erb +9 -0
- data/spec/rails3_mongo_mapper/app/views/sorcery_mailer/reset_password_email.html.erb +16 -0
- data/spec/rails3_mongo_mapper/app/views/sorcery_mailer/reset_password_email.text.erb +8 -0
- data/spec/rails3_mongo_mapper/config/application.rb +51 -0
- data/spec/rails3_mongo_mapper/config/boot.rb +13 -0
- data/spec/rails3_mongo_mapper/config/environment.rb +5 -0
- data/spec/rails3_mongo_mapper/config/environments/development.rb +30 -0
- data/spec/rails3_mongo_mapper/config/environments/in_memory.rb +0 -0
- data/spec/rails3_mongo_mapper/config/environments/production.rb +49 -0
- data/spec/rails3_mongo_mapper/config/environments/test.rb +35 -0
- data/spec/rails3_mongo_mapper/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/rails3_mongo_mapper/config/initializers/inflections.rb +10 -0
- data/spec/rails3_mongo_mapper/config/initializers/mime_types.rb +5 -0
- data/spec/rails3_mongo_mapper/config/initializers/mongo.rb +2 -0
- data/spec/rails3_mongo_mapper/config/initializers/secret_token.rb +7 -0
- data/spec/rails3_mongo_mapper/config/initializers/session_store.rb +8 -0
- data/spec/rails3_mongo_mapper/config/locales/en.yml +5 -0
- data/spec/rails3_mongo_mapper/config/routes.rb +59 -0
- data/spec/rails3_mongo_mapper/config.ru +4 -0
- data/spec/rails3_mongo_mapper/db/schema.rb +23 -0
- data/spec/rails3_mongo_mapper/db/seeds.rb +7 -0
- data/spec/rails3_mongo_mapper/lib/tasks/.gitkeep +0 -0
- data/spec/rails3_mongo_mapper/public/404.html +26 -0
- data/spec/rails3_mongo_mapper/public/422.html +26 -0
- data/spec/rails3_mongo_mapper/public/500.html +26 -0
- data/spec/rails3_mongo_mapper/public/favicon.ico +0 -0
- data/spec/rails3_mongo_mapper/public/images/rails.png +0 -0
- data/spec/rails3_mongo_mapper/public/javascripts/application.js +2 -0
- data/spec/rails3_mongo_mapper/public/javascripts/controls.js +965 -0
- data/spec/rails3_mongo_mapper/public/javascripts/dragdrop.js +974 -0
- data/spec/rails3_mongo_mapper/public/javascripts/effects.js +1123 -0
- data/spec/rails3_mongo_mapper/public/javascripts/prototype.js +6001 -0
- data/spec/rails3_mongo_mapper/public/javascripts/rails.js +175 -0
- data/spec/rails3_mongo_mapper/public/robots.txt +5 -0
- data/spec/rails3_mongo_mapper/public/stylesheets/.gitkeep +0 -0
- data/spec/rails3_mongo_mapper/script/rails +6 -0
- data/spec/{sinatra → rails3_mongo_mapper}/spec/controller_spec.rb +51 -41
- data/spec/rails3_mongo_mapper/spec/spec_helper.orig.rb +27 -0
- data/spec/rails3_mongo_mapper/spec/spec_helper.rb +55 -0
- data/spec/rails3_mongo_mapper/spec/user_activation_spec.rb +9 -0
- data/spec/rails3_mongo_mapper/spec/user_activity_logging_spec.rb +8 -0
- data/spec/rails3_mongo_mapper/spec/user_brute_force_protection_spec.rb +8 -0
- data/spec/rails3_mongo_mapper/spec/user_oauth_spec.rb +8 -0
- data/spec/rails3_mongo_mapper/spec/user_remember_me_spec.rb +8 -0
- data/spec/rails3_mongo_mapper/spec/user_reset_password_spec.rb +8 -0
- data/spec/rails3_mongo_mapper/spec/user_spec.rb +37 -0
- data/spec/rails3_mongo_mapper/vendor/plugins/.gitkeep +0 -0
- data/spec/rails3_mongoid/Gemfile +1 -1
- data/spec/rails3_mongoid/Gemfile.lock +41 -34
- data/spec/rails3_mongoid/spec/controller_activity_logging_spec.rb +98 -0
- data/spec/rails3_mongoid/spec/controller_spec.rb +130 -0
- data/spec/rails3_mongoid/spec/user_spec.rb +1 -0
- data/spec/shared_examples/user_remember_me_shared_examples.rb +1 -0
- data/spec/shared_examples/user_shared_examples.rb +36 -8
- metadata +128 -234
- data/lib/generators/sorcery_migration/sorcery_migration_generator.rb +0 -24
- data/lib/generators/sorcery_migration/templates/activity_logging.rb +0 -17
- data/lib/generators/sorcery_migration/templates/brute_force_protection.rb +0 -11
- data/lib/generators/sorcery_migration/templates/remember_me.rb +0 -15
- data/lib/generators/sorcery_migration/templates/reset_password.rb +0 -13
- data/lib/generators/sorcery_migration/templates/user_activation.rb +0 -17
- data/lib/sorcery/controller/adapters/sinatra.rb +0 -104
- data/lib/sorcery/sinatra.rb +0 -4
- data/lib/sorcery/test_helpers/internal/sinatra.rb +0 -74
- data/lib/sorcery/test_helpers/internal/sinatra_modular.rb +0 -74
- data/lib/sorcery/test_helpers/sinatra.rb +0 -88
- data/spec/rails3/Rakefile.unused +0 -7
- data/spec/rails3/public/index.html +0 -239
- data/spec/sinatra/Gemfile +0 -15
- data/spec/sinatra/Gemfile.lock +0 -117
- data/spec/sinatra/authentication.rb +0 -3
- data/spec/sinatra/db/migrate/activation/20101224223622_add_activation_to_users.rb +0 -17
- data/spec/sinatra/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb +0 -17
- data/spec/sinatra/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb +0 -11
- data/spec/sinatra/db/migrate/core/20101224223620_create_users.rb +0 -16
- data/spec/sinatra/db/migrate/external/20101224223628_create_authentications.rb +0 -14
- data/spec/sinatra/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb +0 -15
- data/spec/sinatra/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb +0 -13
- data/spec/sinatra/filters.rb +0 -27
- data/spec/sinatra/modular.rb +0 -157
- data/spec/sinatra/myapp.rb +0 -133
- data/spec/sinatra/spec/controller_activity_logging_spec.rb +0 -85
- data/spec/sinatra/spec/controller_brute_force_protection_spec.rb +0 -70
- data/spec/sinatra/spec/controller_http_basic_auth_spec.rb +0 -53
- data/spec/sinatra/spec/controller_oauth2_spec.rb +0 -99
- data/spec/sinatra/spec/controller_oauth_spec.rb +0 -100
- data/spec/sinatra/spec/controller_remember_me_spec.rb +0 -64
- data/spec/sinatra/spec/controller_session_timeout_spec.rb +0 -57
- data/spec/sinatra/spec/spec_helper.rb +0 -45
- data/spec/sinatra/user.rb +0 -6
- data/spec/sinatra/views/test_login.erb +0 -4
- data/spec/sinatra_modular/Gemfile.lock +0 -117
- data/spec/sinatra_modular/Rakefile +0 -11
- data/spec/sinatra_modular/authentication.rb +0 -3
- data/spec/sinatra_modular/db/migrate/activation/20101224223622_add_activation_to_users.rb +0 -17
- data/spec/sinatra_modular/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb +0 -17
- data/spec/sinatra_modular/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb +0 -11
- data/spec/sinatra_modular/db/migrate/core/20101224223620_create_users.rb +0 -16
- data/spec/sinatra_modular/db/migrate/external/20101224223628_create_authentications.rb +0 -14
- data/spec/sinatra_modular/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb +0 -15
- data/spec/sinatra_modular/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb +0 -13
- data/spec/sinatra_modular/filters.rb +0 -27
- data/spec/sinatra_modular/modular.rb +0 -157
- data/spec/sinatra_modular/myapp.rb +0 -133
- data/spec/sinatra_modular/sorcery_mailer.rb +0 -25
- data/spec/sinatra_modular/spec_modular/controller_activity_logging_spec.rb +0 -85
- data/spec/sinatra_modular/spec_modular/controller_brute_force_protection_spec.rb +0 -70
- data/spec/sinatra_modular/spec_modular/controller_http_basic_auth_spec.rb +0 -53
- data/spec/sinatra_modular/spec_modular/controller_oauth2_spec.rb +0 -99
- data/spec/sinatra_modular/spec_modular/controller_oauth_spec.rb +0 -100
- data/spec/sinatra_modular/spec_modular/controller_remember_me_spec.rb +0 -64
- data/spec/sinatra_modular/spec_modular/controller_session_timeout_spec.rb +0 -57
- data/spec/sinatra_modular/spec_modular/controller_spec.rb +0 -116
- data/spec/sinatra_modular/spec_modular/spec.opts +0 -2
- data/spec/sinatra_modular/spec_modular/spec_helper.rb +0 -51
- data/spec/sinatra_modular/user.rb +0 -6
- data/spec/sinatra_modular/views/test_login.erb +0 -4
- /data/spec/{sinatra → rails3_mongo_mapper/app/mailers}/sorcery_mailer.rb +0 -0
- /data/spec/{sinatra → rails3_mongo_mapper}/spec/spec.opts +0 -0
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
|
-
|
|
3
|
-
describe Sinatra::Application do
|
|
4
|
-
before(:all) do
|
|
5
|
-
ActiveRecord::Migrator.migrate("#{APP_ROOT}/db/migrate/brute_force_protection")
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
after(:all) do
|
|
9
|
-
ActiveRecord::Migrator.rollback("#{APP_ROOT}/db/migrate/brute_force_protection")
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
# ----------------- SESSION TIMEOUT -----------------------
|
|
13
|
-
describe Sinatra::Application, "with brute force protection features" do
|
|
14
|
-
before(:all) do
|
|
15
|
-
sorcery_reload!([:brute_force_protection])
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
before(:each) do
|
|
19
|
-
create_new_user
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
after(:each) do
|
|
23
|
-
Sorcery::Controller::Config.reset!
|
|
24
|
-
sorcery_controller_property_set(:user_class, User)
|
|
25
|
-
User.delete_all
|
|
26
|
-
Timecop.return
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
it "should count login retries" do
|
|
30
|
-
3.times {get "/test_login", :username => 'gizmo', :password => 'blabla'}
|
|
31
|
-
User.find_by_username('gizmo').failed_logins_count.should == 3
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
it "should reset the counter on a good login" do
|
|
35
|
-
sorcery_model_property_set(:consecutive_login_retries_amount_limit, 5)
|
|
36
|
-
3.times {get "/test_login", :username => 'gizmo', :password => 'blabla'}
|
|
37
|
-
get "/test_login", :username => 'gizmo', :password => 'secret'
|
|
38
|
-
User.find_by_username('gizmo').failed_logins_count.should == 0
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
it "should lock user when number of retries reached the limit" do
|
|
42
|
-
User.find_by_username('gizmo').lock_expires_at.should be_nil
|
|
43
|
-
sorcery_model_property_set(:consecutive_login_retries_amount_limit, 1)
|
|
44
|
-
get "/test_login", :username => 'gizmo', :password => 'blabla'
|
|
45
|
-
User.find_by_username('gizmo').lock_expires_at.should_not be_nil
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
it "should unlock after lock time period passes" do
|
|
49
|
-
sorcery_model_property_set(:consecutive_login_retries_amount_limit, 2)
|
|
50
|
-
sorcery_model_property_set(:login_lock_time_period, 0.2)
|
|
51
|
-
get "/test_login", :username => 'gizmo', :password => 'blabla'
|
|
52
|
-
get "/test_login", :username => 'gizmo', :password => 'blabla'
|
|
53
|
-
User.find_by_username('gizmo').lock_expires_at.should_not be_nil
|
|
54
|
-
Timecop.travel(Time.now+0.3)
|
|
55
|
-
get "/test_login", :username => 'gizmo', :password => 'blabla'
|
|
56
|
-
User.find_by_username('gizmo').lock_expires_at.should be_nil
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
it "should not unlock if time period is 0 (permanent lock)" do
|
|
60
|
-
sorcery_model_property_set(:consecutive_login_retries_amount_limit, 2)
|
|
61
|
-
sorcery_model_property_set(:login_lock_time_period, 0)
|
|
62
|
-
get "/test_login", :username => 'gizmo', :password => 'blabla'
|
|
63
|
-
get "/test_login", :username => 'gizmo', :password => 'blabla'
|
|
64
|
-
unlock_date = User.find_by_username('gizmo').lock_expires_at
|
|
65
|
-
Timecop.travel(Time.now+1)
|
|
66
|
-
get "/test_login", :username => 'gizmo', :password => 'blabla'
|
|
67
|
-
User.find_by_username('gizmo').lock_expires_at.to_s.should == unlock_date.to_s
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
end
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
|
-
require 'base64'
|
|
3
|
-
|
|
4
|
-
describe Sinatra::Application do
|
|
5
|
-
|
|
6
|
-
# ----------------- HTTP BASIC AUTH -----------------------
|
|
7
|
-
describe Sinatra::Application, "with http basic auth features" do
|
|
8
|
-
before(:all) do
|
|
9
|
-
sorcery_reload!([:http_basic_auth])
|
|
10
|
-
create_new_user
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
after(:each) do
|
|
14
|
-
get "/test_logout"
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
it "requests basic authentication when before_filter is used" do
|
|
18
|
-
session[:http_authentication_used] = nil
|
|
19
|
-
get "/test_http_basic_auth"
|
|
20
|
-
last_response.status.should == 401
|
|
21
|
-
session[:http_authentication_used].should == true
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
it "authenticates from http basic if credentials are sent" do
|
|
25
|
-
session[:http_authentication_used] = true
|
|
26
|
-
get "/test_http_basic_auth", {}, {"HTTP_AUTHORIZATION" => "Basic " + Base64::encode64("#{@user.username}:secret")}
|
|
27
|
-
last_response.should be_ok
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it "fails authentication if credentials are wrong" do
|
|
31
|
-
session[:http_authentication_used] = true
|
|
32
|
-
get "/test_http_basic_auth", {}, {"HTTP_AUTHORIZATION" => "Basic " + Base64::encode64("#{@user.username}:wrong!")}
|
|
33
|
-
last_response.should redirect_to 'http://example.org/'
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
it "should allow configuration option 'controller_to_realm_map'" do
|
|
37
|
-
sorcery_controller_property_set(:controller_to_realm_map, {"1" => "2"})
|
|
38
|
-
Sorcery::Controller::Config.controller_to_realm_map.should == {"1" => "2"}
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
it "should display the correct realm name configured for the controller" do
|
|
42
|
-
sorcery_controller_property_set(:controller_to_realm_map, {"application" => "Salad"})
|
|
43
|
-
get "/test_http_basic_auth"
|
|
44
|
-
last_response.headers["WWW-Authenticate"].should == "Basic realm=\"Salad\""
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
it "should sign in the user's session on successful login" do
|
|
48
|
-
session[:http_authentication_used] = true
|
|
49
|
-
get "/test_http_basic_auth", {}, {"HTTP_AUTHORIZATION" => "Basic " + Base64::encode64("#{@user.username}:secret")}
|
|
50
|
-
session[:user_id].should == User.find_by_username(@user.username).id
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../shared_examples/controller_oauth2_shared_examples')
|
|
3
|
-
|
|
4
|
-
def stub_all_oauth2_requests!
|
|
5
|
-
@client = OAuth2::Client.new("key","secret", :site => "http://myapi.com")
|
|
6
|
-
OAuth2::Client.stub!(:new).and_return(@client)
|
|
7
|
-
@acc_token = OAuth2::AccessToken.new(@client, "", "asd", nil, {})
|
|
8
|
-
@webby = @client.web_server
|
|
9
|
-
OAuth2::Strategy::WebServer.stub!(:new).and_return(@webby)
|
|
10
|
-
@webby.stub!(:get_access_token).and_return(@acc_token)
|
|
11
|
-
@acc_token.stub!(:get).and_return({"id"=>"123", "name"=>"Noam Ben Ari", "first_name"=>"Noam", "last_name"=>"Ben Ari", "link"=>"http://www.facebook.com/nbenari1", "hometown"=>{"id"=>"110619208966868", "name"=>"Haifa, Israel"}, "location"=>{"id"=>"106906559341067", "name"=>"Pardes Hanah, Hefa, Israel"}, "bio"=>"I'm a new daddy, and enjoying it!", "gender"=>"male", "email"=>"nbenari@gmail.com", "timezone"=>2, "locale"=>"en_US", "languages"=>[{"id"=>"108405449189952", "name"=>"Hebrew"}, {"id"=>"106059522759137", "name"=>"English"}, {"id"=>"112624162082677", "name"=>"Russian"}], "verified"=>true, "updated_time"=>"2011-02-16T20:59:38+0000"}.to_json)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
describe 'MyApp' do
|
|
15
|
-
before(:all) do
|
|
16
|
-
ActiveRecord::Migrator.migrate("#{APP_ROOT}/db/migrate/external")
|
|
17
|
-
sorcery_reload!([:external])
|
|
18
|
-
sorcery_controller_property_set(:external_providers, [:facebook])
|
|
19
|
-
sorcery_controller_external_property_set(:facebook, :key, "eYVNBjBDi33aa9GkA3w")
|
|
20
|
-
sorcery_controller_external_property_set(:facebook, :secret, "XpbeSdCoaKSmQGSeokz5qcUATClRW5u08QWNfv71N8")
|
|
21
|
-
sorcery_controller_external_property_set(:facebook, :callback_url, "http://blabla.com")
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
after(:all) do
|
|
25
|
-
ActiveRecord::Migrator.rollback("#{APP_ROOT}/db/migrate/external")
|
|
26
|
-
end
|
|
27
|
-
# ----------------- OAuth -----------------------
|
|
28
|
-
describe Sinatra::Application, "with OAuth features" do
|
|
29
|
-
|
|
30
|
-
before(:each) do
|
|
31
|
-
stub_all_oauth2_requests!
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
after(:each) do
|
|
35
|
-
User.delete_all
|
|
36
|
-
Authentication.delete_all
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
it "login_at redirects correctly" do
|
|
40
|
-
create_new_user
|
|
41
|
-
get "/login_at_test2"
|
|
42
|
-
last_response.should be_a_redirect
|
|
43
|
-
#last_response.should redirect_to("http://myapi.com/oauth/authorize?client_id=key&redirect_uri=http%3A%2F%2Fblabla.com&scope=email%2Coffline_access&type=web_server")
|
|
44
|
-
last_response.should redirect_to("http://myapi.com/oauth/authorize?client_id=key&redirect_uri=http%3A%2F%2Fblabla.com&scope=email%2Coffline_access&response_type=code")
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
it "'login_from' logins if user exists" do
|
|
48
|
-
sorcery_model_property_set(:authentications_class, Authentication)
|
|
49
|
-
create_new_external_user(:facebook)
|
|
50
|
-
get "/test_login_from2"
|
|
51
|
-
last_response.body.should == "Success!"
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
it "'login_from' fails if user doesn't exist" do
|
|
55
|
-
sorcery_model_property_set(:authentications_class, Authentication)
|
|
56
|
-
create_new_user
|
|
57
|
-
get "/test_login_from2"
|
|
58
|
-
last_response.body.should == "Failed!"
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
describe Sinatra::Application do
|
|
63
|
-
it_behaves_like "oauth2_controller"
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
describe Sinatra::Application, "OAuth with User Activation features" do
|
|
67
|
-
before(:all) do
|
|
68
|
-
ActiveRecord::Migrator.migrate("#{APP_ROOT}/db/migrate/activation")
|
|
69
|
-
sorcery_reload!([:user_activation,:external], :user_activation_mailer => ::SorceryMailer)
|
|
70
|
-
sorcery_controller_property_set(:external_providers, [:facebook])
|
|
71
|
-
sorcery_controller_external_property_set(:facebook, :key, "eYVNBjBDi33aa9GkA3w")
|
|
72
|
-
sorcery_controller_external_property_set(:facebook, :secret, "XpbeSdCoaKSmQGSeokz5qcUATClRW5u08QWNfv71N8")
|
|
73
|
-
sorcery_controller_external_property_set(:facebook, :callback_url, "http://blabla.com")
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
after(:all) do
|
|
77
|
-
ActiveRecord::Migrator.rollback("#{APP_ROOT}/db/migrate/activation")
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
after(:each) do
|
|
81
|
-
User.delete_all
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
it "should not send activation email to external users" do
|
|
85
|
-
old_size = ActionMailer::Base.deliveries.size
|
|
86
|
-
create_new_external_user(:facebook)
|
|
87
|
-
ActionMailer::Base.deliveries.size.should == old_size
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
it "should not send external users an activation success email" do
|
|
91
|
-
sorcery_model_property_set(:activation_success_email_method_name, nil)
|
|
92
|
-
create_new_external_user(:facebook)
|
|
93
|
-
old_size = ActionMailer::Base.deliveries.size
|
|
94
|
-
@user.activate!
|
|
95
|
-
ActionMailer::Base.deliveries.size.should == old_size
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
end
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../shared_examples/controller_oauth_shared_examples')
|
|
3
|
-
require 'ostruct'
|
|
4
|
-
|
|
5
|
-
def stub_all_oauth_requests!
|
|
6
|
-
@consumer = OAuth::Consumer.new("key","secret", :site => "http://myapi.com")
|
|
7
|
-
OAuth::Consumer.stub!(:new).and_return(@consumer)
|
|
8
|
-
@req_token = OAuth::RequestToken.new(@consumer) # OpenStruct.new()
|
|
9
|
-
@consumer.stub!(:get_request_token).and_return(@req_token)
|
|
10
|
-
@acc_token = OAuth::AccessToken.new(@consumer)
|
|
11
|
-
@req_token.stub!(:get_access_token).and_return(@acc_token)
|
|
12
|
-
session[:request_token] = @req_token.token
|
|
13
|
-
session[:request_token_secret] = @req_token.secret
|
|
14
|
-
OAuth::RequestToken.stub!(:new).and_return(@req_token)
|
|
15
|
-
response = OpenStruct.new()
|
|
16
|
-
response.body = {"following"=>false, "listed_count"=>0, "profile_link_color"=>"0084B4", "profile_image_url"=>"http://a1.twimg.com/profile_images/536178575/noamb_normal.jpg", "description"=>"Programmer/Heavy Metal Fan/New Father", "status"=>{"text"=>"coming soon to sorcery gem: twitter and facebook authentication support.", "truncated"=>false, "favorited"=>false, "source"=>"web", "geo"=>nil, "in_reply_to_screen_name"=>nil, "in_reply_to_user_id"=>nil, "in_reply_to_status_id_str"=>nil, "created_at"=>"Sun Mar 06 23:01:12 +0000 2011", "contributors"=>nil, "place"=>nil, "retweeted"=>false, "in_reply_to_status_id"=>nil, "in_reply_to_user_id_str"=>nil, "coordinates"=>nil, "retweet_count"=>0, "id"=>44533012284706816, "id_str"=>"44533012284706816"}, "show_all_inline_media"=>false, "geo_enabled"=>true, "profile_sidebar_border_color"=>"a8c7f7", "url"=>nil, "followers_count"=>10, "screen_name"=>"nbenari", "profile_use_background_image"=>true, "location"=>"Israel", "statuses_count"=>25, "profile_background_color"=>"022330", "lang"=>"en", "verified"=>false, "notifications"=>false, "profile_background_image_url"=>"http://a3.twimg.com/profile_background_images/104087198/04042010339.jpg", "favourites_count"=>5, "created_at"=>"Fri Nov 20 21:58:19 +0000 2009", "is_translator"=>false, "contributors_enabled"=>false, "protected"=>false, "follow_request_sent"=>false, "time_zone"=>"Greenland", "profile_text_color"=>"333333", "name"=>"Noam Ben Ari", "friends_count"=>10, "profile_sidebar_fill_color"=>"C0DFEC", "id"=>123, "id_str"=>"91434812", "profile_background_tile"=>false, "utc_offset"=>-10800}.to_json
|
|
17
|
-
@acc_token.stub!(:get).and_return(response)
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
describe Sinatra::Application do
|
|
21
|
-
before(:all) do
|
|
22
|
-
ActiveRecord::Migrator.migrate("#{APP_ROOT}/db/migrate/external")
|
|
23
|
-
sorcery_reload!([:external])
|
|
24
|
-
sorcery_controller_property_set(:external_providers, [:twitter])
|
|
25
|
-
sorcery_controller_external_property_set(:twitter, :key, "eYVNBjBDi33aa9GkA3w")
|
|
26
|
-
sorcery_controller_external_property_set(:twitter, :secret, "XpbeSdCoaKSmQGSeokz5qcUATClRW5u08QWNfv71N8")
|
|
27
|
-
sorcery_controller_external_property_set(:twitter, :callback_url, "http://blabla.com")
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
after(:all) do
|
|
31
|
-
ActiveRecord::Migrator.rollback("#{APP_ROOT}/db/migrate/external")
|
|
32
|
-
end
|
|
33
|
-
# ----------------- OAuth -----------------------
|
|
34
|
-
describe Sinatra::Application, "'login_from'" do
|
|
35
|
-
|
|
36
|
-
before(:each) do
|
|
37
|
-
stub_all_oauth_requests!
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
after(:each) do
|
|
41
|
-
User.delete_all
|
|
42
|
-
Authentication.delete_all
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
it "login_at_test redirects correctly" do
|
|
46
|
-
create_new_user
|
|
47
|
-
get "/login_at_test"
|
|
48
|
-
last_response.should be_a_redirect
|
|
49
|
-
last_response.should redirect_to("http://myapi.com/oauth/authorize?oauth_callback=http%3A%2F%2Fblabla.com&oauth_token=")
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
it "logins if user exists" do
|
|
53
|
-
sorcery_model_property_set(:authentications_class, Authentication)
|
|
54
|
-
create_new_external_user(:twitter)
|
|
55
|
-
get '/test_login_from', :oauth_verifier => "blablaRERASDFcxvSDFA"
|
|
56
|
-
last_response.body.should == "Success!"
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
it "'login_from' fails if user doesn't exist" do
|
|
60
|
-
sorcery_model_property_set(:authentications_class, Authentication)
|
|
61
|
-
create_new_user
|
|
62
|
-
get '/test_login_from', :oauth_verifier => "blablaRERASDFcxvSDFA"
|
|
63
|
-
last_response.body.should == "Failed!"
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
describe Sinatra::Application do
|
|
68
|
-
it_behaves_like "oauth_controller"
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
describe Sinatra::Application, "OAuth with User Activation features" do
|
|
72
|
-
before(:all) do
|
|
73
|
-
ActiveRecord::Migrator.migrate("#{APP_ROOT}/db/migrate/activation")
|
|
74
|
-
sorcery_reload!([:user_activation,:external], :user_activation_mailer => ::SorceryMailer)
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
after(:all) do
|
|
78
|
-
ActiveRecord::Migrator.rollback("#{APP_ROOT}/db/migrate/activation")
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
after(:each) do
|
|
82
|
-
User.delete_all
|
|
83
|
-
Authentication.delete_all
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
it "should not send activation email to external users" do
|
|
87
|
-
old_size = ActionMailer::Base.deliveries.size
|
|
88
|
-
create_new_external_user(:twitter)
|
|
89
|
-
ActionMailer::Base.deliveries.size.should == old_size
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
it "should not send external users an activation success email" do
|
|
93
|
-
sorcery_model_property_set(:activation_success_email_method_name, nil)
|
|
94
|
-
create_new_external_user(:twitter)
|
|
95
|
-
old_size = ActionMailer::Base.deliveries.size
|
|
96
|
-
@user.activate!
|
|
97
|
-
ActionMailer::Base.deliveries.size.should == old_size
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
|
-
end
|
|
@@ -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,117 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: ../../
|
|
3
|
-
specs:
|
|
4
|
-
sorcery (0.6.0)
|
|
5
|
-
bcrypt-ruby (~> 3.0.0)
|
|
6
|
-
oauth (>= 0.4.4)
|
|
7
|
-
oauth (>= 0.4.4)
|
|
8
|
-
oauth2 (>= 0.1.1)
|
|
9
|
-
oauth2 (>= 0.1.1)
|
|
10
|
-
|
|
11
|
-
GEM
|
|
12
|
-
remote: http://rubygems.org/
|
|
13
|
-
specs:
|
|
14
|
-
abstract (1.0.0)
|
|
15
|
-
actionmailer (3.0.5)
|
|
16
|
-
actionpack (= 3.0.5)
|
|
17
|
-
mail (~> 2.2.15)
|
|
18
|
-
actionpack (3.0.5)
|
|
19
|
-
activemodel (= 3.0.5)
|
|
20
|
-
activesupport (= 3.0.5)
|
|
21
|
-
builder (~> 2.1.2)
|
|
22
|
-
erubis (~> 2.6.6)
|
|
23
|
-
i18n (~> 0.4)
|
|
24
|
-
rack (~> 1.2.1)
|
|
25
|
-
rack-mount (~> 0.6.13)
|
|
26
|
-
rack-test (~> 0.5.7)
|
|
27
|
-
tzinfo (~> 0.3.23)
|
|
28
|
-
activemodel (3.0.5)
|
|
29
|
-
activesupport (= 3.0.5)
|
|
30
|
-
builder (~> 2.1.2)
|
|
31
|
-
i18n (~> 0.4)
|
|
32
|
-
activerecord (3.0.5)
|
|
33
|
-
activemodel (= 3.0.5)
|
|
34
|
-
activesupport (= 3.0.5)
|
|
35
|
-
arel (~> 2.0.2)
|
|
36
|
-
tzinfo (~> 0.3.23)
|
|
37
|
-
activesupport (3.0.5)
|
|
38
|
-
addressable (2.2.6)
|
|
39
|
-
archive-tar-minitar (0.5.2)
|
|
40
|
-
arel (2.0.7)
|
|
41
|
-
bcrypt-ruby (3.0.0)
|
|
42
|
-
builder (2.1.2)
|
|
43
|
-
columnize (0.3.2)
|
|
44
|
-
diff-lcs (1.1.2)
|
|
45
|
-
erubis (2.6.6)
|
|
46
|
-
abstract (>= 1.0.0)
|
|
47
|
-
faraday (0.6.1)
|
|
48
|
-
addressable (~> 2.2.4)
|
|
49
|
-
multipart-post (~> 1.1.0)
|
|
50
|
-
rack (< 2, >= 1.1.0)
|
|
51
|
-
i18n (0.5.0)
|
|
52
|
-
linecache19 (0.5.11)
|
|
53
|
-
ruby_core_source (>= 0.1.4)
|
|
54
|
-
mail (2.2.15)
|
|
55
|
-
activesupport (>= 2.3.6)
|
|
56
|
-
i18n (>= 0.4.0)
|
|
57
|
-
mime-types (~> 1.16)
|
|
58
|
-
treetop (~> 1.4.8)
|
|
59
|
-
mime-types (1.16)
|
|
60
|
-
multi_json (1.0.3)
|
|
61
|
-
multipart-post (1.1.3)
|
|
62
|
-
oauth (0.4.5)
|
|
63
|
-
oauth2 (0.4.1)
|
|
64
|
-
faraday (~> 0.6.1)
|
|
65
|
-
multi_json (>= 0.0.5)
|
|
66
|
-
polyglot (0.3.1)
|
|
67
|
-
rack (1.2.1)
|
|
68
|
-
rack-mount (0.6.14)
|
|
69
|
-
rack (>= 1.0.0)
|
|
70
|
-
rack-test (0.5.7)
|
|
71
|
-
rack (>= 1.0)
|
|
72
|
-
rake (0.8.7)
|
|
73
|
-
rspec (2.5.0)
|
|
74
|
-
rspec-core (~> 2.5.0)
|
|
75
|
-
rspec-expectations (~> 2.5.0)
|
|
76
|
-
rspec-mocks (~> 2.5.0)
|
|
77
|
-
rspec-core (2.5.1)
|
|
78
|
-
rspec-expectations (2.5.0)
|
|
79
|
-
diff-lcs (~> 1.1.2)
|
|
80
|
-
rspec-mocks (2.5.0)
|
|
81
|
-
ruby-debug-base19 (0.11.24)
|
|
82
|
-
columnize (>= 0.3.1)
|
|
83
|
-
linecache19 (>= 0.5.11)
|
|
84
|
-
ruby_core_source (>= 0.1.4)
|
|
85
|
-
ruby-debug19 (0.11.6)
|
|
86
|
-
columnize (>= 0.3.1)
|
|
87
|
-
linecache19 (>= 0.5.11)
|
|
88
|
-
ruby-debug-base19 (>= 0.11.19)
|
|
89
|
-
ruby_core_source (0.1.4)
|
|
90
|
-
archive-tar-minitar (>= 0.5.2)
|
|
91
|
-
simplecov (0.3.9)
|
|
92
|
-
simplecov-html (>= 0.3.7)
|
|
93
|
-
simplecov-html (0.3.9)
|
|
94
|
-
sinatra (1.2.0)
|
|
95
|
-
rack (~> 1.1)
|
|
96
|
-
tilt (< 2.0, >= 1.2.2)
|
|
97
|
-
sqlite3-ruby (1.3.2)
|
|
98
|
-
tilt (1.2.2)
|
|
99
|
-
timecop (0.3.5)
|
|
100
|
-
treetop (1.4.9)
|
|
101
|
-
polyglot (>= 0.3.1)
|
|
102
|
-
tzinfo (0.3.24)
|
|
103
|
-
|
|
104
|
-
PLATFORMS
|
|
105
|
-
ruby
|
|
106
|
-
|
|
107
|
-
DEPENDENCIES
|
|
108
|
-
actionmailer (>= 3.0.3)
|
|
109
|
-
activerecord (>= 3.0.3)
|
|
110
|
-
rake
|
|
111
|
-
rspec (~> 2.5.0)
|
|
112
|
-
ruby-debug19
|
|
113
|
-
simplecov (>= 0.3.8)
|
|
114
|
-
sinatra (>= 1.2.0)
|
|
115
|
-
sorcery (>= 0.1.0)!
|
|
116
|
-
sqlite3-ruby
|
|
117
|
-
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,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
|