refinerycms 0.9.6.19 → 0.9.6.21
Sign up to get free protection for your applications and to get access to all the features.
- data/.gems +0 -8
- data/.gitignore +3 -1
- data/Rakefile +1 -5
- data/VERSION +1 -1
- data/bin/refinery-update-core +11 -2
- data/config/application.rb +6 -1
- data/config/environments/development.rb +10 -6
- data/config/settings.rb +3 -0
- data/db/migrate/20100305023036_change_users_columns_for_authlogic.rb +46 -0
- data/db/migrate/20100305023037_remove_unused_users_columns.rb +16 -0
- data/db/migrate/20100312155331_make_user_perishable_token_nullable.rb +13 -0
- data/db/migrate/20100312160327_make_user_persistence_token_nullable.rb +13 -0
- data/db/migrate/20100315203301_remove_state_from_users.rb +9 -0
- data/db/schema.rb +8 -21
- data/db/seeds.rb +5 -19
- data/lib/refinery/tasks/refinery.rb +1 -1
- data/public/javascripts/admin.js +6 -2
- data/public/javascripts/jquery-ui-1.8.min.js +374 -0
- data/public/javascripts/jquery.js +606 -444
- data/public/javascripts/refinery/admin.js +30 -9
- data/public/javascripts/refinery/boot_wym.js +4 -0
- data/public/javascripts/wymeditor/jquery.refinery.wymeditor.js +3 -4
- data/public/stylesheets/refinery/refinery.css +11 -0
- data/public/stylesheets/wymeditor/skins/refinery/skin.css +3 -1
- data/public/stylesheets/wymeditor/skins/refinery/wymiframe.css +5 -5
- data/readme.md +13 -10
- data/test/fixtures/users.yml +5 -5
- data/test/functional/dashboard_controller_test.rb +0 -4
- data/test/functional/images_controller_test.rb +0 -3
- data/test/test_helper.rb +7 -3
- data/themes/hemingway/views/layouts/application.html.erb +1 -12
- data/vendor/plugins/authentication/app/controllers/admin/users_controller.rb +1 -3
- data/vendor/plugins/authentication/app/controllers/sessions_controller.rb +3 -14
- data/vendor/plugins/authentication/app/controllers/users_controller.rb +26 -37
- data/vendor/plugins/authentication/app/models/user.rb +29 -112
- data/vendor/plugins/authentication/app/models/user_mailer.rb +8 -5
- data/vendor/plugins/authentication/app/models/user_session.rb +9 -0
- data/vendor/plugins/authentication/app/views/admin/users/index.html.erb +1 -1
- data/vendor/plugins/authentication/app/views/sessions/new.html.erb +5 -4
- data/vendor/plugins/authentication/lib/authenticated_system.rb +40 -30
- data/vendor/plugins/authentication/rails/init.rb +9 -0
- data/vendor/plugins/authlogic/CHANGELOG.rdoc +345 -0
- data/vendor/plugins/authlogic/LICENSE +20 -0
- data/vendor/plugins/authlogic/README.rdoc +246 -0
- data/vendor/plugins/authlogic/Rakefile +42 -0
- data/vendor/plugins/authlogic/VERSION.yml +5 -0
- data/vendor/plugins/authlogic/authlogic.gemspec +217 -0
- data/vendor/plugins/authlogic/generators/session/session_generator.rb +9 -0
- data/vendor/plugins/authlogic/generators/session/templates/session.rb +2 -0
- data/vendor/plugins/authlogic/init.rb +1 -0
- data/vendor/plugins/authlogic/lib/authlogic.rb +64 -0
- data/vendor/plugins/authlogic/lib/authlogic/acts_as_authentic/base.rb +107 -0
- data/vendor/plugins/authlogic/lib/authlogic/acts_as_authentic/email.rb +110 -0
- data/vendor/plugins/authlogic/lib/authlogic/acts_as_authentic/logged_in_status.rb +60 -0
- data/vendor/plugins/authlogic/lib/authlogic/acts_as_authentic/login.rb +141 -0
- data/vendor/plugins/authlogic/lib/authlogic/acts_as_authentic/magic_columns.rb +24 -0
- data/vendor/plugins/authlogic/lib/authlogic/acts_as_authentic/password.rb +355 -0
- data/vendor/plugins/authlogic/lib/authlogic/acts_as_authentic/perishable_token.rb +105 -0
- data/vendor/plugins/authlogic/lib/authlogic/acts_as_authentic/persistence_token.rb +68 -0
- data/vendor/plugins/authlogic/lib/authlogic/acts_as_authentic/restful_authentication.rb +61 -0
- data/vendor/plugins/authlogic/lib/authlogic/acts_as_authentic/session_maintenance.rb +139 -0
- data/vendor/plugins/authlogic/lib/authlogic/acts_as_authentic/single_access_token.rb +65 -0
- data/vendor/plugins/authlogic/lib/authlogic/acts_as_authentic/validations_scope.rb +32 -0
- data/vendor/plugins/authlogic/lib/authlogic/authenticates_many/association.rb +42 -0
- data/vendor/plugins/authlogic/lib/authlogic/authenticates_many/base.rb +55 -0
- data/vendor/plugins/authlogic/lib/authlogic/controller_adapters/abstract_adapter.rb +67 -0
- data/vendor/plugins/authlogic/lib/authlogic/controller_adapters/merb_adapter.rb +30 -0
- data/vendor/plugins/authlogic/lib/authlogic/controller_adapters/rails_adapter.rb +48 -0
- data/vendor/plugins/authlogic/lib/authlogic/controller_adapters/sinatra_adapter.rb +61 -0
- data/vendor/plugins/authlogic/lib/authlogic/crypto_providers/aes256.rb +43 -0
- data/vendor/plugins/authlogic/lib/authlogic/crypto_providers/bcrypt.rb +90 -0
- data/vendor/plugins/authlogic/lib/authlogic/crypto_providers/md5.rb +34 -0
- data/vendor/plugins/authlogic/lib/authlogic/crypto_providers/sha1.rb +35 -0
- data/vendor/plugins/authlogic/lib/authlogic/crypto_providers/sha256.rb +50 -0
- data/vendor/plugins/authlogic/lib/authlogic/crypto_providers/sha512.rb +50 -0
- data/vendor/plugins/authlogic/lib/authlogic/crypto_providers/wordpress.rb +43 -0
- data/vendor/plugins/authlogic/lib/authlogic/i18n.rb +83 -0
- data/vendor/plugins/authlogic/lib/authlogic/i18n/translator.rb +15 -0
- data/vendor/plugins/authlogic/lib/authlogic/random.rb +33 -0
- data/vendor/plugins/authlogic/lib/authlogic/regex.rb +25 -0
- data/vendor/plugins/authlogic/lib/authlogic/session/activation.rb +58 -0
- data/vendor/plugins/authlogic/lib/authlogic/session/active_record_trickery.rb +64 -0
- data/vendor/plugins/authlogic/lib/authlogic/session/base.rb +37 -0
- data/vendor/plugins/authlogic/lib/authlogic/session/brute_force_protection.rb +96 -0
- data/vendor/plugins/authlogic/lib/authlogic/session/callbacks.rb +99 -0
- data/vendor/plugins/authlogic/lib/authlogic/session/cookies.rb +130 -0
- data/vendor/plugins/authlogic/lib/authlogic/session/existence.rb +93 -0
- data/vendor/plugins/authlogic/lib/authlogic/session/foundation.rb +63 -0
- data/vendor/plugins/authlogic/lib/authlogic/session/http_auth.rb +58 -0
- data/vendor/plugins/authlogic/lib/authlogic/session/id.rb +41 -0
- data/vendor/plugins/authlogic/lib/authlogic/session/klass.rb +78 -0
- data/vendor/plugins/authlogic/lib/authlogic/session/magic_columns.rb +95 -0
- data/vendor/plugins/authlogic/lib/authlogic/session/magic_states.rb +59 -0
- data/vendor/plugins/authlogic/lib/authlogic/session/params.rb +101 -0
- data/vendor/plugins/authlogic/lib/authlogic/session/password.rb +240 -0
- data/vendor/plugins/authlogic/lib/authlogic/session/perishable_token.rb +18 -0
- data/vendor/plugins/authlogic/lib/authlogic/session/persistence.rb +70 -0
- data/vendor/plugins/authlogic/lib/authlogic/session/priority_record.rb +34 -0
- data/vendor/plugins/authlogic/lib/authlogic/session/scopes.rb +101 -0
- data/vendor/plugins/authlogic/lib/authlogic/session/session.rb +62 -0
- data/vendor/plugins/authlogic/lib/authlogic/session/timeout.rb +82 -0
- data/vendor/plugins/authlogic/lib/authlogic/session/unauthorized_record.rb +50 -0
- data/vendor/plugins/authlogic/lib/authlogic/session/validation.rb +82 -0
- data/vendor/plugins/authlogic/lib/authlogic/test_case.rb +120 -0
- data/vendor/plugins/authlogic/lib/authlogic/test_case/mock_controller.rb +45 -0
- data/vendor/plugins/authlogic/lib/authlogic/test_case/mock_cookie_jar.rb +14 -0
- data/vendor/plugins/authlogic/lib/authlogic/test_case/mock_logger.rb +10 -0
- data/vendor/plugins/authlogic/lib/authlogic/test_case/mock_request.rb +19 -0
- data/vendor/plugins/authlogic/lib/authlogic/test_case/rails_request_adapter.rb +30 -0
- data/vendor/plugins/authlogic/rails/init.rb +1 -0
- data/vendor/plugins/authlogic/shoulda_macros/authlogic.rb +69 -0
- data/vendor/plugins/authlogic/test/acts_as_authentic_test/base_test.rb +18 -0
- data/vendor/plugins/authlogic/test/acts_as_authentic_test/email_test.rb +97 -0
- data/vendor/plugins/authlogic/test/acts_as_authentic_test/logged_in_status_test.rb +36 -0
- data/vendor/plugins/authlogic/test/acts_as_authentic_test/login_test.rb +109 -0
- data/vendor/plugins/authlogic/test/acts_as_authentic_test/magic_columns_test.rb +27 -0
- data/vendor/plugins/authlogic/test/acts_as_authentic_test/password_test.rb +236 -0
- data/vendor/plugins/authlogic/test/acts_as_authentic_test/perishable_token_test.rb +90 -0
- data/vendor/plugins/authlogic/test/acts_as_authentic_test/persistence_token_test.rb +55 -0
- data/vendor/plugins/authlogic/test/acts_as_authentic_test/restful_authentication_test.rb +40 -0
- data/vendor/plugins/authlogic/test/acts_as_authentic_test/session_maintenance_test.rb +84 -0
- data/vendor/plugins/authlogic/test/acts_as_authentic_test/single_access_test.rb +44 -0
- data/vendor/plugins/authlogic/test/authenticates_many_test.rb +16 -0
- data/vendor/plugins/authlogic/test/crypto_provider_test/aes256_test.rb +14 -0
- data/vendor/plugins/authlogic/test/crypto_provider_test/bcrypt_test.rb +14 -0
- data/vendor/plugins/authlogic/test/crypto_provider_test/sha1_test.rb +23 -0
- data/vendor/plugins/authlogic/test/crypto_provider_test/sha256_test.rb +14 -0
- data/vendor/plugins/authlogic/test/crypto_provider_test/sha512_test.rb +14 -0
- data/vendor/plugins/authlogic/test/fixtures/companies.yml +5 -0
- data/vendor/plugins/authlogic/test/fixtures/employees.yml +17 -0
- data/vendor/plugins/authlogic/test/fixtures/projects.yml +3 -0
- data/vendor/plugins/authlogic/test/fixtures/users.yml +24 -0
- data/vendor/plugins/authlogic/test/i18n_test.rb +33 -0
- data/vendor/plugins/authlogic/test/libs/affiliate.rb +7 -0
- data/vendor/plugins/authlogic/test/libs/company.rb +6 -0
- data/vendor/plugins/authlogic/test/libs/employee.rb +7 -0
- data/vendor/plugins/authlogic/test/libs/employee_session.rb +2 -0
- data/vendor/plugins/authlogic/test/libs/ldaper.rb +3 -0
- data/vendor/plugins/authlogic/test/libs/ordered_hash.rb +9 -0
- data/vendor/plugins/authlogic/test/libs/project.rb +3 -0
- data/vendor/plugins/authlogic/test/libs/user.rb +5 -0
- data/vendor/plugins/authlogic/test/libs/user_session.rb +6 -0
- data/vendor/plugins/authlogic/test/random_test.rb +49 -0
- data/vendor/plugins/authlogic/test/session_test/activation_test.rb +43 -0
- data/vendor/plugins/authlogic/test/session_test/active_record_trickery_test.rb +36 -0
- data/vendor/plugins/authlogic/test/session_test/brute_force_protection_test.rb +101 -0
- data/vendor/plugins/authlogic/test/session_test/callbacks_test.rb +6 -0
- data/vendor/plugins/authlogic/test/session_test/cookies_test.rb +112 -0
- data/vendor/plugins/authlogic/test/session_test/credentials_test.rb +0 -0
- data/vendor/plugins/authlogic/test/session_test/existence_test.rb +64 -0
- data/vendor/plugins/authlogic/test/session_test/http_auth_test.rb +28 -0
- data/vendor/plugins/authlogic/test/session_test/id_test.rb +17 -0
- data/vendor/plugins/authlogic/test/session_test/klass_test.rb +40 -0
- data/vendor/plugins/authlogic/test/session_test/magic_columns_test.rb +62 -0
- data/vendor/plugins/authlogic/test/session_test/magic_states_test.rb +60 -0
- data/vendor/plugins/authlogic/test/session_test/params_test.rb +53 -0
- data/vendor/plugins/authlogic/test/session_test/password_test.rb +106 -0
- data/vendor/plugins/authlogic/test/session_test/perishability_test.rb +15 -0
- data/vendor/plugins/authlogic/test/session_test/persistence_test.rb +21 -0
- data/vendor/plugins/authlogic/test/session_test/scopes_test.rb +60 -0
- data/vendor/plugins/authlogic/test/session_test/session_test.rb +59 -0
- data/vendor/plugins/authlogic/test/session_test/timeout_test.rb +52 -0
- data/vendor/plugins/authlogic/test/session_test/unauthorized_record_test.rb +13 -0
- data/vendor/plugins/authlogic/test/session_test/validation_test.rb +23 -0
- data/vendor/plugins/authlogic/test/test_helper.rb +182 -0
- data/vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb +1 -1
- data/vendor/plugins/friendly_id/Changelog.md +243 -0
- data/vendor/plugins/friendly_id/Contributors.md +30 -0
- data/vendor/plugins/friendly_id/Gemfile +2 -0
- data/vendor/plugins/friendly_id/Guide.md +509 -0
- data/vendor/plugins/friendly_id/LICENSE +19 -0
- data/vendor/plugins/friendly_id/README.md +76 -0
- data/vendor/plugins/friendly_id/Rakefile +68 -0
- data/vendor/plugins/friendly_id/extras/README.txt +3 -0
- data/vendor/plugins/friendly_id/extras/bench.rb +59 -0
- data/vendor/plugins/friendly_id/extras/extras.rb +31 -0
- data/vendor/plugins/friendly_id/extras/prof.rb +14 -0
- data/vendor/plugins/friendly_id/extras/template-gem.rb +26 -0
- data/vendor/plugins/friendly_id/extras/template-plugin.rb +28 -0
- data/vendor/plugins/friendly_id/friendly_id.gemspec +40 -0
- data/vendor/plugins/friendly_id/generators/friendly_id/friendly_id_generator.rb +28 -0
- data/vendor/plugins/friendly_id/generators/friendly_id/templates/create_slugs.rb +18 -0
- data/vendor/plugins/friendly_id/lib/friendly_id.rb +67 -0
- data/vendor/plugins/friendly_id/lib/friendly_id/active_record2.rb +47 -0
- data/vendor/plugins/friendly_id/lib/friendly_id/active_record2/configuration.rb +66 -0
- data/vendor/plugins/friendly_id/lib/friendly_id/active_record2/finders.rb +140 -0
- data/vendor/plugins/friendly_id/lib/friendly_id/active_record2/simple_model.rb +162 -0
- data/vendor/plugins/friendly_id/lib/friendly_id/active_record2/slug.rb +111 -0
- data/vendor/plugins/friendly_id/lib/friendly_id/active_record2/slugged_model.rb +323 -0
- data/vendor/plugins/friendly_id/lib/friendly_id/active_record2/tasks.rb +66 -0
- data/vendor/plugins/friendly_id/lib/friendly_id/active_record2/tasks/friendly_id.rake +19 -0
- data/vendor/plugins/friendly_id/lib/friendly_id/configuration.rb +132 -0
- data/vendor/plugins/friendly_id/lib/friendly_id/finders.rb +106 -0
- data/vendor/plugins/friendly_id/lib/friendly_id/slug_string.rb +292 -0
- data/vendor/plugins/friendly_id/lib/friendly_id/slugged.rb +91 -0
- data/vendor/plugins/friendly_id/lib/friendly_id/status.rb +35 -0
- data/vendor/plugins/friendly_id/lib/friendly_id/test.rb +175 -0
- data/vendor/plugins/friendly_id/lib/friendly_id/version.rb +8 -0
- data/vendor/plugins/friendly_id/rails/init.rb +2 -0
- data/vendor/plugins/friendly_id/test/active_record2/basic_slugged_model_test.rb +14 -0
- data/vendor/plugins/friendly_id/test/active_record2/cached_slug_test.rb +61 -0
- data/vendor/plugins/friendly_id/test/active_record2/core.rb +93 -0
- data/vendor/plugins/friendly_id/test/active_record2/custom_normalizer_test.rb +20 -0
- data/vendor/plugins/friendly_id/test/active_record2/custom_table_name_test.rb +22 -0
- data/vendor/plugins/friendly_id/test/active_record2/deprecated_test.rb +23 -0
- data/vendor/plugins/friendly_id/test/active_record2/scoped_model_test.rb +111 -0
- data/vendor/plugins/friendly_id/test/active_record2/simple_test.rb +59 -0
- data/vendor/plugins/friendly_id/test/active_record2/slug_test.rb +34 -0
- data/vendor/plugins/friendly_id/test/active_record2/slugged.rb +30 -0
- data/vendor/plugins/friendly_id/test/active_record2/slugged_status_test.rb +61 -0
- data/vendor/plugins/friendly_id/test/active_record2/sti_test.rb +22 -0
- data/vendor/plugins/friendly_id/test/active_record2/support/database.mysql.yml +4 -0
- data/vendor/plugins/friendly_id/test/active_record2/support/database.postgres.yml +6 -0
- data/vendor/plugins/friendly_id/test/active_record2/support/database.sqlite3.yml +2 -0
- data/vendor/plugins/friendly_id/test/active_record2/support/models.rb +78 -0
- data/vendor/plugins/friendly_id/test/active_record2/tasks_test.rb +82 -0
- data/vendor/plugins/friendly_id/test/active_record2/test_helper.rb +114 -0
- data/vendor/plugins/friendly_id/test/friendly_id_test.rb +60 -0
- data/vendor/plugins/friendly_id/test/slug_string_test.rb +78 -0
- data/vendor/plugins/friendly_id/test/test_helper.rb +9 -0
- data/vendor/plugins/hpricot/CHANGELOG +88 -0
- data/vendor/plugins/hpricot/COPYING +18 -0
- data/vendor/plugins/hpricot/README +275 -0
- data/vendor/plugins/hpricot/Rakefile +272 -0
- data/vendor/plugins/hpricot/ext/fast_xs/FastXsService.java +1030 -0
- data/vendor/plugins/hpricot/ext/fast_xs/extconf.rb +4 -0
- data/vendor/plugins/hpricot/ext/fast_xs/fast_xs.c +201 -0
- data/vendor/plugins/hpricot/ext/hpricot_scan/HpricotCss.java +831 -0
- data/vendor/plugins/hpricot/ext/hpricot_scan/HpricotScanService.java +2086 -0
- data/vendor/plugins/hpricot/ext/hpricot_scan/MANIFEST +0 -0
- data/vendor/plugins/hpricot/ext/hpricot_scan/extconf.rb +6 -0
- data/vendor/plugins/hpricot/ext/hpricot_scan/hpricot_common.rl +76 -0
- data/vendor/plugins/hpricot/ext/hpricot_scan/hpricot_css.c +3503 -0
- data/vendor/plugins/hpricot/ext/hpricot_scan/hpricot_css.java.rl +155 -0
- data/vendor/plugins/hpricot/ext/hpricot_scan/hpricot_css.rl +115 -0
- data/vendor/plugins/hpricot/ext/hpricot_scan/hpricot_scan.c +6927 -0
- data/vendor/plugins/hpricot/ext/hpricot_scan/hpricot_scan.h +79 -0
- data/vendor/plugins/hpricot/ext/hpricot_scan/hpricot_scan.java.rl +1152 -0
- data/vendor/plugins/hpricot/ext/hpricot_scan/hpricot_scan.rl +788 -0
- data/vendor/plugins/hpricot/extras/mingw-rbconfig.rb +176 -0
- data/vendor/plugins/hpricot/hpricot.gemspec +17 -0
- data/vendor/plugins/hpricot/lib/hpricot.rb +26 -0
- data/vendor/plugins/hpricot/lib/hpricot/blankslate.rb +63 -0
- data/vendor/plugins/hpricot/lib/hpricot/builder.rb +216 -0
- data/vendor/plugins/hpricot/lib/hpricot/elements.rb +510 -0
- data/vendor/plugins/hpricot/lib/hpricot/htmlinfo.rb +691 -0
- data/vendor/plugins/hpricot/lib/hpricot/inspect.rb +103 -0
- data/vendor/plugins/hpricot/lib/hpricot/modules.rb +40 -0
- data/vendor/plugins/hpricot/lib/hpricot/parse.rb +38 -0
- data/vendor/plugins/hpricot/lib/hpricot/tag.rb +219 -0
- data/vendor/plugins/hpricot/lib/hpricot/tags.rb +164 -0
- data/vendor/plugins/hpricot/lib/hpricot/traverse.rb +839 -0
- data/vendor/plugins/hpricot/lib/hpricot/xchar.rb +94 -0
- data/vendor/plugins/hpricot/setup.rb +1585 -0
- data/vendor/plugins/hpricot/test/files/basic.xhtml +17 -0
- data/vendor/plugins/hpricot/test/files/boingboing.html +2266 -0
- data/vendor/plugins/hpricot/test/files/cy0.html +3653 -0
- data/vendor/plugins/hpricot/test/files/immob.html +400 -0
- data/vendor/plugins/hpricot/test/files/pace_application.html +1320 -0
- data/vendor/plugins/hpricot/test/files/tenderlove.html +16 -0
- data/vendor/plugins/hpricot/test/files/uswebgen.html +220 -0
- data/vendor/plugins/hpricot/test/files/utf8.html +1054 -0
- data/vendor/plugins/hpricot/test/files/week9.html +1723 -0
- data/vendor/plugins/hpricot/test/files/why.xml +19 -0
- data/vendor/plugins/hpricot/test/load_files.rb +7 -0
- data/vendor/plugins/hpricot/test/nokogiri-bench.rb +64 -0
- data/vendor/plugins/hpricot/test/test_alter.rb +96 -0
- data/vendor/plugins/hpricot/test/test_builder.rb +37 -0
- data/vendor/plugins/hpricot/test/test_parser.rb +428 -0
- data/vendor/plugins/hpricot/test/test_paths.rb +25 -0
- data/vendor/plugins/hpricot/test/test_preserved.rb +88 -0
- data/vendor/plugins/hpricot/test/test_xml.rb +28 -0
- data/vendor/plugins/inquiries/app/controllers/admin/inquiries_controller.rb +1 -6
- data/vendor/plugins/inquiries/app/helpers/inquiries_helper.rb +0 -11
- data/vendor/plugins/inquiries/app/views/admin/inquiries/_inquiry.html.erb +10 -6
- data/vendor/plugins/inquiries/app/views/inquiry_mailer/confirmation.html.erb +1 -1
- data/vendor/plugins/inquiries/config/routes.rb +1 -1
- data/vendor/plugins/pages/app/controllers/admin/pages_controller.rb +16 -3
- data/vendor/plugins/pages/app/models/page_part.rb +9 -0
- data/vendor/plugins/rails_indexes/lib/indexer.rb +0 -2
- data/vendor/plugins/refinery/app/views/admin/_head.html.erb +2 -1
- data/vendor/plugins/refinery/app/views/shared/_head.html.erb +0 -1
- data/vendor/plugins/refinery/app/views/shared/_ie6check.html.erb +23 -11
- data/vendor/plugins/refinery/app/views/welcome.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/wymiframe.html.erb +2 -1
- data/vendor/plugins/refinery/lib/generators/refinery/USAGE +1 -1
- data/vendor/plugins/refinery/lib/generators/refinery/templates/migration.rb +2 -2
- data/vendor/plugins/refinery/lib/generators/refinery/templates/model.rb +4 -0
- data/vendor/plugins/refinery/lib/generators/refinery/templates/views/admin/_form.html.erb +6 -0
- data/vendor/plugins/refinery/lib/generators/refinery/templates/views/show.html.erb +5 -3
- data/vendor/plugins/refinery/lib/refinery/application_helper.rb +2 -2
- data/vendor/plugins/refinery/lib/refinery/initializer.rb +4 -41
- data/vendor/plugins/refinery_settings/app/models/refinery_setting.rb +7 -3
- data/vendor/plugins/slim_scrooge/README.textile +112 -0
- data/vendor/plugins/slim_scrooge/Rakefile +29 -0
- data/vendor/plugins/slim_scrooge/VERSION.yml +5 -0
- data/vendor/plugins/slim_scrooge/ext/Rakefile +42 -0
- data/vendor/plugins/slim_scrooge/ext/extconf.rb +5 -0
- data/vendor/plugins/slim_scrooge/lib/slim_scrooge.rb +16 -0
- data/vendor/plugins/slim_scrooge/lib/slim_scrooge/callsite.rb +96 -0
- data/vendor/plugins/slim_scrooge/lib/slim_scrooge/callsites.rb +70 -0
- data/vendor/plugins/slim_scrooge/lib/slim_scrooge/monitored_hash.rb +103 -0
- data/vendor/plugins/slim_scrooge/lib/slim_scrooge/result_set.rb +38 -0
- data/vendor/plugins/slim_scrooge/lib/slim_scrooge/simple_set.rb +34 -0
- data/vendor/plugins/slim_scrooge/lib/slim_scrooge/slim_scrooge.rb +46 -0
- data/vendor/plugins/slim_scrooge/rails/init.rb +8 -0
- data/vendor/plugins/slim_scrooge/slim_scrooge.gemspec +62 -0
- data/vendor/plugins/slim_scrooge/slim_scrooge_windows.gemspec +59 -0
- data/vendor/plugins/slim_scrooge/test/active_record_setup.rb +3 -0
- data/vendor/plugins/slim_scrooge/test/helper.rb +91 -0
- data/vendor/plugins/slim_scrooge/test/models/course.rb +2 -0
- data/vendor/plugins/slim_scrooge/test/schema/schema.rb +5 -0
- data/vendor/plugins/slim_scrooge/test/setup.rb +5 -0
- data/vendor/plugins/themes/app/models/theme.rb +7 -0
- data/vendor/plugins/themes/lib/theme_server.rb +3 -1
- data/vendor/plugins/themes/rails/init.rb +16 -13
- data/vendor/plugins/will_paginate/.manifest +43 -0
- data/vendor/plugins/will_paginate/CHANGELOG.rdoc +139 -0
- data/vendor/plugins/will_paginate/LICENSE +18 -0
- data/vendor/plugins/will_paginate/README.rdoc +107 -0
- data/vendor/plugins/will_paginate/Rakefile +53 -0
- data/vendor/plugins/will_paginate/examples/apple-circle.gif +0 -0
- data/vendor/plugins/will_paginate/examples/index.haml +69 -0
- data/vendor/plugins/will_paginate/examples/index.html +92 -0
- data/vendor/plugins/will_paginate/examples/pagination.css +90 -0
- data/vendor/plugins/will_paginate/examples/pagination.sass +91 -0
- data/vendor/plugins/will_paginate/init.rb +1 -0
- data/vendor/plugins/will_paginate/lib/will_paginate.rb +90 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/array.rb +16 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/collection.rb +146 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/core_ext.rb +43 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/finder.rb +264 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/named_scope.rb +170 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/named_scope_patch.rb +37 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/version.rb +9 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb +408 -0
- data/vendor/plugins/will_paginate/test/boot.rb +21 -0
- data/vendor/plugins/will_paginate/test/collection_test.rb +143 -0
- data/vendor/plugins/will_paginate/test/console +8 -0
- data/vendor/plugins/will_paginate/test/database.yml +22 -0
- data/vendor/plugins/will_paginate/test/finder_test.rb +473 -0
- data/vendor/plugins/will_paginate/test/fixtures/admin.rb +3 -0
- data/vendor/plugins/will_paginate/test/fixtures/developer.rb +14 -0
- data/vendor/plugins/will_paginate/test/fixtures/developers_projects.yml +13 -0
- data/vendor/plugins/will_paginate/test/fixtures/project.rb +15 -0
- data/vendor/plugins/will_paginate/test/fixtures/projects.yml +6 -0
- data/vendor/plugins/will_paginate/test/fixtures/replies.yml +29 -0
- data/vendor/plugins/will_paginate/test/fixtures/reply.rb +7 -0
- data/vendor/plugins/will_paginate/test/fixtures/schema.rb +38 -0
- data/vendor/plugins/will_paginate/test/fixtures/topic.rb +10 -0
- data/vendor/plugins/will_paginate/test/fixtures/topics.yml +30 -0
- data/vendor/plugins/will_paginate/test/fixtures/user.rb +2 -0
- data/vendor/plugins/will_paginate/test/fixtures/users.yml +35 -0
- data/vendor/plugins/will_paginate/test/helper.rb +37 -0
- data/vendor/plugins/will_paginate/test/lib/activerecord_test_case.rb +43 -0
- data/vendor/plugins/will_paginate/test/lib/activerecord_test_connector.rb +75 -0
- data/vendor/plugins/will_paginate/test/lib/load_fixtures.rb +11 -0
- data/vendor/plugins/will_paginate/test/lib/view_test_process.rb +179 -0
- data/vendor/plugins/will_paginate/test/tasks.rake +59 -0
- data/vendor/plugins/will_paginate/test/view_test.rb +373 -0
- data/vendor/plugins/will_paginate/will_paginate.gemspec +19 -0
- metadata +308 -27
- data/db/migrate/20091029034951_remove_blurb_from_news_items.rb +0 -9
- data/public/javascripts/jquery-ui-1.8rc1.min.js +0 -375
- data/test/fixtures/news_items.yml +0 -14
- data/test/unit/news_items_test.rb +0 -33
- data/vendor/plugins/authentication/test/fixtures/users.yml +0 -19
- data/vendor/plugins/authentication/test/functional/sessions_controller_test.rb +0 -85
- data/vendor/plugins/authentication/test/functional/users_controller_test.rb +0 -99
- data/vendor/plugins/authentication/test/unit/user_test.rb +0 -164
- data/vendor/plugins/news/app/controllers/admin/news_items_controller.rb +0 -5
- data/vendor/plugins/news/app/controllers/news_items_controller.rb +0 -20
- data/vendor/plugins/news/app/models/news_item.rb +0 -24
- data/vendor/plugins/news/app/views/admin/news_items/_form.html.erb +0 -19
- data/vendor/plugins/news/app/views/admin/news_items/_news_item.html.erb +0 -15
- data/vendor/plugins/news/app/views/admin/news_items/edit.html.erb +0 -1
- data/vendor/plugins/news/app/views/admin/news_items/index.html.erb +0 -31
- data/vendor/plugins/news/app/views/admin/news_items/new.html.erb +0 -1
- data/vendor/plugins/news/app/views/news_items/_recent_posts.html.erb +0 -8
- data/vendor/plugins/news/app/views/news_items/index.html.erb +0 -17
- data/vendor/plugins/news/app/views/news_items/index.rss.builder +0 -26
- data/vendor/plugins/news/app/views/news_items/show.html.erb +0 -13
- data/vendor/plugins/news/config/routes.rb +0 -7
- data/vendor/plugins/news/news.md +0 -20
- data/vendor/plugins/news/rails/init.rb +0 -11
@@ -0,0 +1,18 @@
|
|
1
|
+
module Authlogic
|
2
|
+
module Session
|
3
|
+
# Maintains the perishable token, which is helpful for confirming records or authorizing records to reset their password. All that this
|
4
|
+
# module does is reset it after a session have been saved, just keep it changing. The more it changes, the tighter the security.
|
5
|
+
#
|
6
|
+
# See Authlogic::ActsAsAuthentic::PerishableToken for more information.
|
7
|
+
module PerishableToken
|
8
|
+
def self.included(klass)
|
9
|
+
klass.after_save :reset_perishable_token!
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
def reset_perishable_token!
|
14
|
+
record.reset_perishable_token if record.respond_to?(:reset_perishable_token) && !record.disable_perishable_token_maintenance?
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Authlogic
|
2
|
+
module Session
|
3
|
+
# Responsible for allowing you to persist your sessions.
|
4
|
+
module Persistence
|
5
|
+
def self.included(klass)
|
6
|
+
klass.class_eval do
|
7
|
+
extend ClassMethods
|
8
|
+
include InstanceMethods
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
module ClassMethods
|
13
|
+
# This is how you persist a session. This finds the record for the current session using
|
14
|
+
# a variety of methods. It basically tries to "log in" the user without the user having
|
15
|
+
# to explicitly log in. Check out the other Authlogic::Session modules for more information.
|
16
|
+
#
|
17
|
+
# The best way to use this method is something like:
|
18
|
+
#
|
19
|
+
# helper_method :current_user_session, :current_user
|
20
|
+
#
|
21
|
+
# def current_user_session
|
22
|
+
# return @current_user_session if defined?(@current_user_session)
|
23
|
+
# @current_user_session = UserSession.find
|
24
|
+
# end
|
25
|
+
#
|
26
|
+
# def current_user
|
27
|
+
# return @current_user if defined?(@current_user)
|
28
|
+
# @current_user = current_user_session && current_user_session.user
|
29
|
+
# end
|
30
|
+
#
|
31
|
+
# Also, this method accepts a single parameter as the id, to find session that you marked with an id:
|
32
|
+
#
|
33
|
+
# UserSession.find(:secure)
|
34
|
+
#
|
35
|
+
# See the id method for more information on ids.
|
36
|
+
def find(id = nil, priority_record = nil)
|
37
|
+
session = new({:priority_record => priority_record}, id)
|
38
|
+
session.priority_record = priority_record
|
39
|
+
if session.persisting?
|
40
|
+
session
|
41
|
+
else
|
42
|
+
nil
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
module InstanceMethods
|
48
|
+
# Let's you know if the session is being persisted or not, meaning the user does not have to explicitly log in
|
49
|
+
# in order to be logged in. If the session has no associated record, it will try to find a record and persis
|
50
|
+
# the session. This is the method that the class level method find uses to ultimately persist the session.
|
51
|
+
def persisting?
|
52
|
+
return true if !record.nil?
|
53
|
+
self.attempted_record = nil
|
54
|
+
before_persisting
|
55
|
+
persist
|
56
|
+
ensure_authentication_attempted
|
57
|
+
if errors.empty? && !attempted_record.nil?
|
58
|
+
self.record = attempted_record
|
59
|
+
after_persisting
|
60
|
+
save_record
|
61
|
+
self.new_session = false
|
62
|
+
true
|
63
|
+
else
|
64
|
+
false
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Authlogic
|
2
|
+
module Session
|
3
|
+
# The point of this module is to avoid the StaleObjectError raised when lock_version is implemented in ActiveRecord.
|
4
|
+
# We accomplish this by using a "priority record". Meaning this record is used if possible, it gets priority.
|
5
|
+
# This way we don't save a record behind the scenes thus making an object being used stale.
|
6
|
+
module PriorityRecord
|
7
|
+
def self.included(klass)
|
8
|
+
klass.class_eval do
|
9
|
+
attr_accessor :priority_record
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# Setting priority record if it is passed. The only way it can be passed is through an array:
|
14
|
+
#
|
15
|
+
# session.credentials = [real_user_object, priority_user_object]
|
16
|
+
def credentials=(value)
|
17
|
+
super
|
18
|
+
values = value.is_a?(Array) ? value : [value]
|
19
|
+
self.priority_record = values[1] if values[1].class < ::ActiveRecord::Base
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
def attempted_record=(value)
|
24
|
+
value = priority_record if value == priority_record
|
25
|
+
super
|
26
|
+
end
|
27
|
+
|
28
|
+
def save_record(alternate_record = nil)
|
29
|
+
r = alternate_record || record
|
30
|
+
super if r != priority_record
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
module Authlogic
|
2
|
+
module Session
|
3
|
+
# Authentication can be scoped, and it's easy, you just need to define how you want to scope everything. This should help you:
|
4
|
+
#
|
5
|
+
# 1. Want to scope by a parent object? Ex: An account has many users. Checkout Authlogic::AuthenticatesMany
|
6
|
+
# 2. Want to scope the validations in your model? Ex: 2 users can have the same login under different accounts. See Authlogic::ActsAsAuthentic::Scope
|
7
|
+
module Scopes # :nodoc:
|
8
|
+
def self.included(klass)
|
9
|
+
klass.class_eval do
|
10
|
+
extend ClassMethods
|
11
|
+
include InstanceMethods
|
12
|
+
attr_writer :scope
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# = Scopes
|
17
|
+
module ClassMethods
|
18
|
+
# The current scope set, should be used in the block passed to with_scope.
|
19
|
+
def scope
|
20
|
+
Thread.current[:authlogic_scope]
|
21
|
+
end
|
22
|
+
|
23
|
+
# What with_scopes focuses on is scoping the query when finding the object and the name of the cookie / session. It works very similar to
|
24
|
+
# ActiveRecord::Base#with_scopes. It accepts a hash with any of the following options:
|
25
|
+
#
|
26
|
+
# * <tt>find_options:</tt> any options you can pass into ActiveRecord::Base.find. This is used when trying to find the record.
|
27
|
+
# * <tt>id:</tt> The id of the session, this gets merged with the real id. For information ids see the id method.
|
28
|
+
#
|
29
|
+
# Here is how you use it:
|
30
|
+
#
|
31
|
+
# UserSession.with_scope(:find_options => {:conditions => "account_id = 2"}, :id => "account_2") do
|
32
|
+
# UserSession.find
|
33
|
+
# end
|
34
|
+
#
|
35
|
+
# Eseentially what the above does is scope the searching of the object with the sql you provided. So instead of:
|
36
|
+
#
|
37
|
+
# User.find(:first, :conditions => "login = 'ben'")
|
38
|
+
#
|
39
|
+
# it would be:
|
40
|
+
#
|
41
|
+
# User.find(:first, :conditions => "login = 'ben' and account_id = 2")
|
42
|
+
#
|
43
|
+
# You will also notice the :id option. This works just like the id method. It scopes your cookies. So the name of your cookie will be:
|
44
|
+
#
|
45
|
+
# account_2_user_credentials
|
46
|
+
#
|
47
|
+
# instead of:
|
48
|
+
#
|
49
|
+
# user_credentials
|
50
|
+
#
|
51
|
+
# What is also nifty about scoping with an :id is that it merges your id's. So if you do:
|
52
|
+
#
|
53
|
+
# UserSession.with_scope(:find_options => {:conditions => "account_id = 2"}, :id => "account_2") do
|
54
|
+
# session = UserSession.new
|
55
|
+
# session.id = :secure
|
56
|
+
# end
|
57
|
+
#
|
58
|
+
# The name of your cookies will be:
|
59
|
+
#
|
60
|
+
# secure_account_2_user_credentials
|
61
|
+
def with_scope(options = {}, &block)
|
62
|
+
raise ArgumentError.new("You must provide a block") unless block_given?
|
63
|
+
self.scope = options
|
64
|
+
result = yield
|
65
|
+
self.scope = nil
|
66
|
+
result
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
def scope=(value)
|
71
|
+
Thread.current[:authlogic_scope] = value
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
module InstanceMethods
|
76
|
+
# Setting the scope if it exists upon instantiation.
|
77
|
+
def initialize(*args)
|
78
|
+
self.scope = self.class.scope
|
79
|
+
super
|
80
|
+
end
|
81
|
+
|
82
|
+
# The scope of the current object
|
83
|
+
def scope
|
84
|
+
@scope ||= {}
|
85
|
+
end
|
86
|
+
|
87
|
+
private
|
88
|
+
# Used for things like cookie_key, session_key, etc.
|
89
|
+
def build_key(last_part)
|
90
|
+
[scope[:id], super].compact.join("_")
|
91
|
+
end
|
92
|
+
|
93
|
+
def search_for_record(*args)
|
94
|
+
klass.send(:with_scope, :find => (scope[:find_options] || {})) do
|
95
|
+
klass.send(*args)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module Authlogic
|
2
|
+
module Session
|
3
|
+
# Handles all parts of authentication that deal with sessions. Such as persisting a session and saving / destroy a session.
|
4
|
+
module Session
|
5
|
+
def self.included(klass)
|
6
|
+
klass.class_eval do
|
7
|
+
extend Config
|
8
|
+
include InstanceMethods
|
9
|
+
persist :persist_by_session
|
10
|
+
after_save :update_session
|
11
|
+
after_destroy :update_session
|
12
|
+
after_persisting :update_session, :unless => :single_access?
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# Configuration for the session feature.
|
17
|
+
module Config
|
18
|
+
# Works exactly like cookie_key, but for sessions. See cookie_key for more info.
|
19
|
+
#
|
20
|
+
# * <tt>Default:</tt> cookie_key
|
21
|
+
# * <tt>Accepts:</tt> Symbol or String
|
22
|
+
def session_key(value = nil)
|
23
|
+
rw_config(:session_key, value, cookie_key)
|
24
|
+
end
|
25
|
+
alias_method :session_key=, :session_key
|
26
|
+
end
|
27
|
+
|
28
|
+
# Instance methods for the session feature.
|
29
|
+
module InstanceMethods
|
30
|
+
private
|
31
|
+
# Tries to validate the session from information in the session
|
32
|
+
def persist_by_session
|
33
|
+
persistence_token, record_id = session_credentials
|
34
|
+
if !persistence_token.nil?
|
35
|
+
# Allow finding by persistence token, because when records are created the session is maintained in a before_save, when there is no id.
|
36
|
+
# This is done for performance reasons and to save on queries.
|
37
|
+
record = record_id.nil? ?
|
38
|
+
search_for_record("find_by_persistence_token", persistence_token) :
|
39
|
+
search_for_record("find_by_#{klass.primary_key}", record_id)
|
40
|
+
self.unauthorized_record = record if record && record.persistence_token == persistence_token
|
41
|
+
valid?
|
42
|
+
else
|
43
|
+
false
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def session_credentials
|
48
|
+
[controller.session[session_key], controller.session["#{session_key}_#{klass.primary_key}"]].compact
|
49
|
+
end
|
50
|
+
|
51
|
+
def session_key
|
52
|
+
build_key(self.class.session_key)
|
53
|
+
end
|
54
|
+
|
55
|
+
def update_session
|
56
|
+
controller.session[session_key] = record && record.persistence_token
|
57
|
+
controller.session["#{session_key}_#{klass.primary_key}"] = record && record.send(record.class.primary_key)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
module Authlogic
|
2
|
+
module Session
|
3
|
+
# Think about financial websites, if you are inactive for a certain period of time you will be asked to
|
4
|
+
# log back in on your next request. You can do this with Authlogic easily, there are 2 parts to this:
|
5
|
+
#
|
6
|
+
# 1. Define the timeout threshold:
|
7
|
+
#
|
8
|
+
# acts_as_authentic do |c|
|
9
|
+
# c.logged_in_timeout = 10.minutes # default is 10.minutes
|
10
|
+
# end
|
11
|
+
#
|
12
|
+
# 2. Enable logging out on timeouts
|
13
|
+
#
|
14
|
+
# class UserSession < Authlogic::Session::Base
|
15
|
+
# logout_on_timeout true # default if false
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# This will require a user to log back in if they are inactive for more than 10 minutes. In order for
|
19
|
+
# this feature to be used you must have a last_request_at datetime column in your table for whatever model
|
20
|
+
# you are authenticating with.
|
21
|
+
module Timeout
|
22
|
+
def self.included(klass)
|
23
|
+
klass.class_eval do
|
24
|
+
extend Config
|
25
|
+
include InstanceMethods
|
26
|
+
before_persisting :reset_stale_state
|
27
|
+
after_persisting :enforce_timeout
|
28
|
+
attr_accessor :stale_record
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# Configuration for the timeout feature.
|
33
|
+
module Config
|
34
|
+
# With acts_as_authentic you get a :logged_in_timeout configuration option. If this is set, after this amount of time has passed the user
|
35
|
+
# will be marked as logged out. Obviously, since web based apps are on a per request basis, we have to define a time limit threshold that
|
36
|
+
# determines when we consider a user to be "logged out". Meaning, if they login and then leave the website, when do mark them as logged out?
|
37
|
+
# I recommend just using this as a fun feature on your website or reports, giving you a ballpark number of users logged in and active. This is
|
38
|
+
# not meant to be a dead accurate representation of a users logged in state, since there is really no real way to do this with web based apps.
|
39
|
+
# Think about a user that logs in and doesn't log out. There is no action that tells you that the user isn't technically still logged in and
|
40
|
+
# active.
|
41
|
+
#
|
42
|
+
# That being said, you can use that feature to require a new login if their session timesout. Similar to how financial sites work. Just set this option to
|
43
|
+
# true and if your record returns true for stale? then they will be required to log back in.
|
44
|
+
#
|
45
|
+
# Lastly, UserSession.find will still return a object is the session is stale, but you will not get a record. This allows you to determine if the
|
46
|
+
# user needs to log back in because their session went stale, or because they just aren't logged in. Just call current_user_session.stale? as your flag.
|
47
|
+
#
|
48
|
+
# * <tt>Default:</tt> false
|
49
|
+
# * <tt>Accepts:</tt> Boolean
|
50
|
+
def logout_on_timeout(value = nil)
|
51
|
+
rw_config(:logout_on_timeout, value, false)
|
52
|
+
end
|
53
|
+
alias_method :logout_on_timeout=, :logout_on_timeout
|
54
|
+
end
|
55
|
+
|
56
|
+
# Instance methods for the timeout feature.
|
57
|
+
module InstanceMethods
|
58
|
+
# Tells you if the record is stale or not. Meaning the record has timed out. This will only return true if you set logout_on_timeout to true in your configuration.
|
59
|
+
# Basically how a bank website works. If you aren't active over a certain period of time your session becomes stale and requires you to log back in.
|
60
|
+
def stale?
|
61
|
+
!stale_record.nil? || (logout_on_timeout? && record && record.logged_out?)
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
def reset_stale_state
|
66
|
+
self.stale_record = nil
|
67
|
+
end
|
68
|
+
|
69
|
+
def enforce_timeout
|
70
|
+
if stale?
|
71
|
+
self.stale_record = record
|
72
|
+
self.record = nil
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def logout_on_timeout?
|
77
|
+
self.class.logout_on_timeout == true
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Authlogic
|
2
|
+
module Session
|
3
|
+
# Allows you to create session with an object. Ex:
|
4
|
+
#
|
5
|
+
# UserSession.create(my_user_object)
|
6
|
+
#
|
7
|
+
# Be careful with this, because Authlogic is assuming that you have already confirmed that the
|
8
|
+
# user is who he says he is.
|
9
|
+
#
|
10
|
+
# For example, this is the method used to persist the session internally. Authlogic finds the user with
|
11
|
+
# the persistence token. At this point we know the user is who he says he is, so Authlogic just creates a
|
12
|
+
# session with the record. This is particularly useful for 3rd party authentication methods, such as
|
13
|
+
# OpenID. Let that method verify the identity, once it's verified, pass the object and create a session.
|
14
|
+
module UnauthorizedRecord
|
15
|
+
def self.included(klass)
|
16
|
+
klass.class_eval do
|
17
|
+
attr_accessor :unauthorized_record
|
18
|
+
validate :validate_by_unauthorized_record, :if => :authenticating_with_unauthorized_record?
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# Returning meaningful credentials
|
23
|
+
def credentials
|
24
|
+
if authenticating_with_unauthorized_record?
|
25
|
+
details = {}
|
26
|
+
details[:unauthorized_record] = "<protected>"
|
27
|
+
details
|
28
|
+
else
|
29
|
+
super
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# Setting the unauthorized record if it exists in the credentials passed.
|
34
|
+
def credentials=(value)
|
35
|
+
super
|
36
|
+
values = value.is_a?(Array) ? value : [value]
|
37
|
+
self.unauthorized_record = values.first if values.first.class < ::ActiveRecord::Base
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
def authenticating_with_unauthorized_record?
|
42
|
+
!unauthorized_record.nil?
|
43
|
+
end
|
44
|
+
|
45
|
+
def validate_by_unauthorized_record
|
46
|
+
self.attempted_record = unauthorized_record
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
module Authlogic
|
2
|
+
module Session
|
3
|
+
# Responsible for session validation
|
4
|
+
module Validation
|
5
|
+
# The errors in Authlogic work JUST LIKE ActiveRecord. In fact, it uses the exact same ActiveRecord errors class. Use it the same way:
|
6
|
+
#
|
7
|
+
# class UserSession
|
8
|
+
# validate :check_if_awesome
|
9
|
+
#
|
10
|
+
# private
|
11
|
+
# def check_if_awesome
|
12
|
+
# errors.add(:login, "must contain awesome") if login && !login.include?("awesome")
|
13
|
+
# errors.add(:base, "You must be awesome to log in") unless attempted_record.awesome?
|
14
|
+
# end
|
15
|
+
# end
|
16
|
+
class Errors < (defined?(::ActiveModel) ? ::ActiveModel::Errors : ::ActiveRecord::Errors)
|
17
|
+
unless defined?(::ActiveModel)
|
18
|
+
def [](key)
|
19
|
+
value = super
|
20
|
+
value.is_a?(Array) ? value : [value].compact
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# You should use this as a place holder for any records that you find during validation. The main reason for this is to
|
26
|
+
# allow other modules to use it if needed. Take the failed_login_count feature, it needs this in order to increase
|
27
|
+
# the failed login count.
|
28
|
+
def attempted_record
|
29
|
+
@attempted_record
|
30
|
+
end
|
31
|
+
|
32
|
+
# See attempted_record
|
33
|
+
def attempted_record=(value)
|
34
|
+
@attempted_record = value
|
35
|
+
end
|
36
|
+
|
37
|
+
# The errors in Authlogic work JUST LIKE ActiveRecord. In fact, it uses the exact same ActiveRecord errors class.
|
38
|
+
# Use it the same way:
|
39
|
+
#
|
40
|
+
# === Example
|
41
|
+
#
|
42
|
+
# class UserSession
|
43
|
+
# before_validation :check_if_awesome
|
44
|
+
#
|
45
|
+
# private
|
46
|
+
# def check_if_awesome
|
47
|
+
# errors.add(:login, "must contain awesome") if login && !login.include?("awesome")
|
48
|
+
# errors.add(:base, "You must be awesome to log in") unless attempted_record.awesome?
|
49
|
+
# end
|
50
|
+
# end
|
51
|
+
def errors
|
52
|
+
@errors ||= Errors.new(self)
|
53
|
+
end
|
54
|
+
|
55
|
+
# Determines if the information you provided for authentication is valid or not. If there is
|
56
|
+
# a problem with the information provided errors will be added to the errors object and this
|
57
|
+
# method will return false.
|
58
|
+
def valid?
|
59
|
+
errors.clear
|
60
|
+
self.attempted_record = nil
|
61
|
+
|
62
|
+
before_validation
|
63
|
+
new_session? ? before_validation_on_create : before_validation_on_update
|
64
|
+
validate
|
65
|
+
ensure_authentication_attempted
|
66
|
+
|
67
|
+
if errors.size == 0
|
68
|
+
new_session? ? after_validation_on_create : after_validation_on_update
|
69
|
+
after_validation
|
70
|
+
end
|
71
|
+
|
72
|
+
save_record(attempted_record)
|
73
|
+
errors.size == 0
|
74
|
+
end
|
75
|
+
|
76
|
+
private
|
77
|
+
def ensure_authentication_attempted
|
78
|
+
errors.add(:base, I18n.t('error_messages.no_authentication_details', :default => "You did not provide any details for authentication.")) if errors.empty? && attempted_record.nil?
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|