From 7b2f54c313ce10db131581ee3e438565a1df74d1 Mon Sep 17 00:00:00 2001 From: Daniel Croak Date: Wed, 2 Sep 2009 17:17:29 -0400 Subject: [PATCH] upgraded clearance to 0.8.2 --- config/environment.rb | 2 +- vendor/gems/thoughtbot-clearance-0.7.0/.specification | 145 ------------------------------------------------------------------------------------------------------------------------------------------------- vendor/gems/thoughtbot-clearance-0.7.0/CHANGELOG.textile | 176 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- vendor/gems/thoughtbot-clearance-0.7.0/LICENSE | 21 --------------------- vendor/gems/thoughtbot-clearance-0.7.0/README.textile | 123 --------------------------------------------------------------------------------------------------------------------------- vendor/gems/thoughtbot-clearance-0.7.0/Rakefile | 103 ------------------------------------------------------------------------------------------------------- vendor/gems/thoughtbot-clearance-0.7.0/TODO.textile | 6 ------ vendor/gems/thoughtbot-clearance-0.7.0/app/controllers/clearance/confirmations_controller.rb | 73 ------------------------------------------------------------------------- vendor/gems/thoughtbot-clearance-0.7.0/app/controllers/clearance/passwords_controller.rb | 81 --------------------------------------------------------------------------------- vendor/gems/thoughtbot-clearance-0.7.0/app/controllers/clearance/sessions_controller.rb | 67 ------------------------------------------------------------------- vendor/gems/thoughtbot-clearance-0.7.0/app/controllers/clearance/users_controller.rb | 35 ----------------------------------- vendor/gems/thoughtbot-clearance-0.7.0/app/models/clearance_mailer.rb | 23 ----------------------- vendor/gems/thoughtbot-clearance-0.7.0/app/views/clearance_mailer/change_password.html.erb | 7 ------- vendor/gems/thoughtbot-clearance-0.7.0/app/views/clearance_mailer/confirmation.html.erb | 2 -- vendor/gems/thoughtbot-clearance-0.7.0/app/views/passwords/edit.html.erb | 23 ----------------------- vendor/gems/thoughtbot-clearance-0.7.0/app/views/passwords/new.html.erb | 15 --------------- vendor/gems/thoughtbot-clearance-0.7.0/app/views/sessions/new.html.erb | 28 ---------------------------- vendor/gems/thoughtbot-clearance-0.7.0/app/views/users/_form.html.erb | 13 ------------- vendor/gems/thoughtbot-clearance-0.7.0/app/views/users/new.html.erb | 6 ------ vendor/gems/thoughtbot-clearance-0.7.0/config/clearance_routes.rb | 30 ------------------------------ vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/USAGE | 1 - vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/clearance_generator.rb | 41 ----------------------------------------- vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/lib/insert_commands.rb | 33 --------------------------------- vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/lib/rake_commands.rb | 22 ---------------------- vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/templates/README | 22 ---------------------- vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/templates/factories.rb | 13 ------------- vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/templates/migrations/create_users.rb | 21 --------------------- vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/templates/migrations/update_users.rb | 41 ----------------------------------------- vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/templates/user.rb | 3 --- vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/USAGE | 1 - vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/clearance_features_generator.rb | 20 -------------------- vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/password_reset.feature | 33 --------------------------------- vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/sign_in.feature | 42 ------------------------------------------ vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/sign_out.feature | 23 ----------------------- vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/sign_up.feature | 45 --------------------------------------------- vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/step_definitions/clearance_steps.rb | 110 -------------------------------------------------------------------------------------------------------------- vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/step_definitions/factory_girl_steps.rb | 5 ----- vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/support/paths.rb | 22 ---------------------- vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/USAGE | 0 vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/clearance_views_generator.rb | 27 --------------------------- vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/templates/formtastic/passwords/edit.html.erb | 21 --------------------- vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/templates/formtastic/passwords/new.html.erb | 15 --------------- vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/templates/formtastic/sessions/new.html.erb | 22 ---------------------- vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/templates/formtastic/users/_inputs.html.erb | 6 ------ vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/templates/formtastic/users/new.html.erb | 10 ---------- vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance.rb | 6 ------ vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance/authentication.rb | 102 ------------------------------------------------------------------------------------------------------ vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance/extensions/errors.rb | 6 ------ vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance/extensions/rescue.rb | 3 --- vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance/extensions/routes.rb | 14 -------------- vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance/user.rb | 143 ----------------------------------------------------------------------------------------------------------------------------------------------- vendor/gems/thoughtbot-clearance-0.7.0/rails/init.rb | 1 - vendor/gems/thoughtbot-clearance-0.7.0/shoulda_macros/clearance.rb | 268 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- vendor/gems/thoughtbot-clearance-0.8.2/CHANGELOG.textile | 194 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/LICENSE | 21 +++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/README.textile | 123 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/Rakefile | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/TODO.textile | 6 ++++++ vendor/gems/thoughtbot-clearance-0.8.2/app/controllers/clearance/confirmations_controller.rb | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/app/controllers/clearance/passwords_controller.rb | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/app/controllers/clearance/sessions_controller.rb | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/app/controllers/clearance/users_controller.rb | 35 +++++++++++++++++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/app/models/clearance_mailer.rb | 23 +++++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/app/views/clearance_mailer/change_password.html.erb | 9 +++++++++ vendor/gems/thoughtbot-clearance-0.8.2/app/views/clearance_mailer/confirmation.html.erb | 5 +++++ vendor/gems/thoughtbot-clearance-0.8.2/app/views/passwords/edit.html.erb | 23 +++++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/app/views/passwords/new.html.erb | 15 +++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/app/views/sessions/new.html.erb | 24 ++++++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/app/views/users/_form.html.erb | 13 +++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/app/views/users/new.html.erb | 6 ++++++ vendor/gems/thoughtbot-clearance-0.8.2/config/clearance_routes.rb | 30 ++++++++++++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/USAGE | 1 + vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/clearance_generator.rb | 41 +++++++++++++++++++++++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/lib/insert_commands.rb | 33 +++++++++++++++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/lib/rake_commands.rb | 22 ++++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/templates/README | 22 ++++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/templates/factories.rb | 13 +++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/templates/migrations/create_users.rb | 21 +++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/templates/migrations/update_users.rb | 41 +++++++++++++++++++++++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/templates/user.rb | 3 +++ vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/USAGE | 1 + vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/clearance_features_generator.rb | 20 ++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/password_reset.feature | 33 +++++++++++++++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/sign_in.feature | 35 +++++++++++++++++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/sign_out.feature | 15 +++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/sign_up.feature | 45 +++++++++++++++++++++++++++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/step_definitions/clearance_steps.rb | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/step_definitions/factory_girl_steps.rb | 5 +++++ vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/support/paths.rb | 22 ++++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/USAGE | 0 vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/clearance_views_generator.rb | 27 +++++++++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/templates/formtastic/passwords/edit.html.erb | 21 +++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/templates/formtastic/passwords/new.html.erb | 15 +++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/templates/formtastic/sessions/new.html.erb | 21 +++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/templates/formtastic/users/_inputs.html.erb | 6 ++++++ vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/templates/formtastic/users/new.html.erb | 10 ++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance.rb | 6 ++++++ vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance/authentication.rb | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance/extensions/errors.rb | 6 ++++++ vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance/extensions/rescue.rb | 3 +++ vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance/extensions/routes.rb | 14 ++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance/user.rb | 199 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ vendor/gems/thoughtbot-clearance-0.8.2/rails/init.rb | 1 + vendor/gems/thoughtbot-clearance-0.8.2/shoulda_macros/clearance.rb | 266 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 104 files changed, 2065 insertions(+), 2120 deletions(-) delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/.specification delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/CHANGELOG.textile delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/LICENSE delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/README.textile delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/Rakefile delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/TODO.textile delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/app/controllers/clearance/confirmations_controller.rb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/app/controllers/clearance/passwords_controller.rb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/app/controllers/clearance/sessions_controller.rb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/app/controllers/clearance/users_controller.rb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/app/models/clearance_mailer.rb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/app/views/clearance_mailer/change_password.html.erb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/app/views/clearance_mailer/confirmation.html.erb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/app/views/passwords/edit.html.erb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/app/views/passwords/new.html.erb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/app/views/sessions/new.html.erb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/app/views/users/_form.html.erb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/app/views/users/new.html.erb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/config/clearance_routes.rb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/USAGE delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/clearance_generator.rb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/lib/insert_commands.rb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/lib/rake_commands.rb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/templates/README delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/templates/factories.rb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/templates/migrations/create_users.rb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/templates/migrations/update_users.rb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/templates/user.rb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/USAGE delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/clearance_features_generator.rb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/password_reset.feature delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/sign_in.feature delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/sign_out.feature delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/sign_up.feature delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/step_definitions/clearance_steps.rb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/step_definitions/factory_girl_steps.rb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/support/paths.rb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/USAGE delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/clearance_views_generator.rb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/templates/formtastic/passwords/edit.html.erb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/templates/formtastic/passwords/new.html.erb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/templates/formtastic/sessions/new.html.erb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/templates/formtastic/users/_inputs.html.erb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/templates/formtastic/users/new.html.erb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance.rb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance/authentication.rb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance/extensions/errors.rb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance/extensions/rescue.rb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance/extensions/routes.rb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance/user.rb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/rails/init.rb delete mode 100644 vendor/gems/thoughtbot-clearance-0.7.0/shoulda_macros/clearance.rb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/CHANGELOG.textile create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/LICENSE create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/README.textile create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/Rakefile create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/TODO.textile create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/app/controllers/clearance/confirmations_controller.rb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/app/controllers/clearance/passwords_controller.rb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/app/controllers/clearance/sessions_controller.rb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/app/controllers/clearance/users_controller.rb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/app/models/clearance_mailer.rb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/app/views/clearance_mailer/change_password.html.erb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/app/views/clearance_mailer/confirmation.html.erb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/app/views/passwords/edit.html.erb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/app/views/passwords/new.html.erb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/app/views/sessions/new.html.erb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/app/views/users/_form.html.erb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/app/views/users/new.html.erb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/config/clearance_routes.rb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/USAGE create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/clearance_generator.rb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/lib/insert_commands.rb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/lib/rake_commands.rb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/templates/README create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/templates/factories.rb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/templates/migrations/create_users.rb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/templates/migrations/update_users.rb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/templates/user.rb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/USAGE create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/clearance_features_generator.rb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/password_reset.feature create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/sign_in.feature create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/sign_out.feature create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/sign_up.feature create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/step_definitions/clearance_steps.rb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/step_definitions/factory_girl_steps.rb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/support/paths.rb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/USAGE create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/clearance_views_generator.rb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/templates/formtastic/passwords/edit.html.erb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/templates/formtastic/passwords/new.html.erb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/templates/formtastic/sessions/new.html.erb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/templates/formtastic/users/_inputs.html.erb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/templates/formtastic/users/new.html.erb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance.rb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance/authentication.rb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance/extensions/errors.rb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance/extensions/rescue.rb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance/extensions/routes.rb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance/user.rb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/rails/init.rb create mode 100644 vendor/gems/thoughtbot-clearance-0.8.2/shoulda_macros/clearance.rb diff --git a/config/environment.rb b/config/environment.rb index 7cd201b..7d56103 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -49,7 +49,7 @@ Rails::Initializer.run do |config| config.gem "thoughtbot-clearance", :lib => 'clearance', :source => 'http://gems.github.com', - :version => '0.7.0' + :version => '0.8.2' config.gem "activemerchant", :lib => 'active_merchant', :version => '1.4.2' diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/.specification b/vendor/gems/thoughtbot-clearance-0.7.0/.specification deleted file mode 100644 index 236e31f..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/.specification +++ /dev/null @@ -1,145 +0,0 @@ ---- !ruby/object:Gem::Specification -name: thoughtbot-clearance -version: !ruby/object:Gem::Version - version: 0.7.0 -platform: ruby -authors: -- Dan Croak -- Mike Burns -- Jason Morrison -- Joe Ferris -- Eugene Bolshakov -- Nick Quaranto -- Josh Nichols -- Mike Breen -- "Marcel G\xC3\xB6rner" -- Bence Nagy -- Ben Mabey -- Eloy Duran -- Tim Pope -- Mihai Anca -- Mark Cornick -- Shay Arnett -autorequire: -bindir: bin -cert_chain: [] - -date: 2009-08-04 00:00:00 -04:00 -default_executable: -dependencies: [] - -description: Rails authentication with email & password. -email: support@thoughtbot.com -executables: [] - -extensions: [] - -extra_rdoc_files: [] - -files: -- CHANGELOG.textile -- LICENSE -- Rakefile -- README.textile -- TODO.textile -- app/controllers -- app/controllers/clearance -- app/controllers/clearance/confirmations_controller.rb -- app/controllers/clearance/passwords_controller.rb -- app/controllers/clearance/sessions_controller.rb -- app/controllers/clearance/users_controller.rb -- app/models -- app/models/clearance_mailer.rb -- app/views -- app/views/clearance_mailer -- app/views/clearance_mailer/change_password.html.erb -- app/views/clearance_mailer/confirmation.html.erb -- app/views/passwords -- app/views/passwords/edit.html.erb -- app/views/passwords/new.html.erb -- app/views/sessions -- app/views/sessions/new.html.erb -- app/views/users -- app/views/users/_form.html.erb -- app/views/users/new.html.erb -- config/clearance_routes.rb -- generators/clearance -- generators/clearance/clearance_generator.rb -- generators/clearance/lib -- generators/clearance/lib/insert_commands.rb -- generators/clearance/lib/rake_commands.rb -- generators/clearance/templates -- generators/clearance/templates/factories.rb -- generators/clearance/templates/migrations -- generators/clearance/templates/migrations/create_users.rb -- generators/clearance/templates/migrations/update_users.rb -- generators/clearance/templates/README -- generators/clearance/templates/user.rb -- generators/clearance/USAGE -- generators/clearance_features -- generators/clearance_features/clearance_features_generator.rb -- generators/clearance_features/templates -- generators/clearance_features/templates/features -- generators/clearance_features/templates/features/password_reset.feature -- generators/clearance_features/templates/features/sign_in.feature -- generators/clearance_features/templates/features/sign_out.feature -- generators/clearance_features/templates/features/sign_up.feature -- generators/clearance_features/templates/features/step_definitions -- generators/clearance_features/templates/features/step_definitions/clearance_steps.rb -- generators/clearance_features/templates/features/step_definitions/factory_girl_steps.rb -- generators/clearance_features/templates/features/support -- generators/clearance_features/templates/features/support/paths.rb -- generators/clearance_features/USAGE -- generators/clearance_views -- generators/clearance_views/clearance_views_generator.rb -- generators/clearance_views/templates -- generators/clearance_views/templates/formtastic -- generators/clearance_views/templates/formtastic/passwords -- generators/clearance_views/templates/formtastic/passwords/edit.html.erb -- generators/clearance_views/templates/formtastic/passwords/new.html.erb -- generators/clearance_views/templates/formtastic/sessions -- generators/clearance_views/templates/formtastic/sessions/new.html.erb -- generators/clearance_views/templates/formtastic/users -- generators/clearance_views/templates/formtastic/users/_inputs.html.erb -- generators/clearance_views/templates/formtastic/users/new.html.erb -- generators/clearance_views/USAGE -- lib/clearance -- lib/clearance/authentication.rb -- lib/clearance/extensions -- lib/clearance/extensions/errors.rb -- lib/clearance/extensions/rescue.rb -- lib/clearance/extensions/routes.rb -- lib/clearance/user.rb -- lib/clearance.rb -- shoulda_macros/clearance.rb -- rails/init.rb -has_rdoc: true -homepage: http://github.com/thoughtbot/clearance -licenses: [] - -post_install_message: -rdoc_options: [] - -require_paths: -- lib -required_ruby_version: !ruby/object:Gem::Requirement - requirements: - - - ">=" - - !ruby/object:Gem::Version - version: "0" - version: -required_rubygems_version: !ruby/object:Gem::Requirement - requirements: - - - ">=" - - !ruby/object:Gem::Version - version: "0" - version: -requirements: [] - -rubyforge_project: -rubygems_version: 1.3.4 -signing_key: -specification_version: 3 -summary: Rails authentication with email & password. -test_files: [] - diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/CHANGELOG.textile b/vendor/gems/thoughtbot-clearance-0.7.0/CHANGELOG.textile deleted file mode 100644 index c493128..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/CHANGELOG.textile +++ /dev/null @@ -1,176 +0,0 @@ -h2. 0.7.0 (08/04/2009) - -* Redirect signed in user who clicks confirmation link again. (Dan Croak) -* Redirect signed out user who clicks confirmation link again. (Dan Croak) -* Added signed_out? convenience method for controllers, helpers, views. (Dan -Croak) -* Added clearance_views generator. By default, creates formtastic views which -pass all tests and features. (Dan Croak) - -h2. 0.6.9 (07/04/2009) - -* Added timestamps to create users migration. (Dan Croak) -* Ready for Ruby 1.9. (Jason Morrison, Nick Quaranto) - -h2. 0.6.8 (06/24/2009) - -* Added defined? checks for various Rails constants such as ActionController -for easier unit testing of Clearance extensions... particularly ActiveRecord -extensions... particularly strong_password. (Dan Croak) - -h2. 0.6.7 (06/13/2009) - -* [#30] Added sign_up, sign_in, sign_out named routes. (Dan Croak) -* [#22] Minimizing Reek smell: Duplication in redirect_back_or. (Dan Croak) -* Deprecated sign_user_in. Told developers to use sign_in instead. (Dan -Croak) -* [#16] flash_success_after_create, flash_notice_after_create, flash_failure_after_create, flash_sucess_after_update, flash_success_after_destroy, etc. (Dan Croak) -* [#17] bug. added #create to forbidden before_filters on confirmations controller. (Dan Croak) -* [#24] should_be_signed_in_as shouldn't look in the session. (Dan Croak) -* README improvements. (Dan Croak) -* Move routes loading to separate file. (Joshua Clayton) - -h2. 0.6.6 (05/18/2009) - -* [#14] replaced class_eval in Clearance::User with modules. This was needed -in a thoughtbot client app so we could write our own validations. (Dan Croak) - -h2. 0.6.5 (05/17/2009) - -* [#6] Make Clearance i18n aware. (Timur Vafin, Marcel Goerner, Eugene Bolshakov, Dan Croak) - -h2. 0.6.4 (05/12/2009) - -* Moved issue tracking to Github from Lighthouse. (Dan Croak) -* [#7] asking higher-level questions of controllers in webrat steps, such as signed_in? instead of what's in the session. same for accessors. (Dan Croak) -* [#11] replacing sign_in_as & sign_out shoulda macros with a stubbing (requires no dependency) approach. this will avoid dealing with the internals of current_user, such as session & cookies. added sign_in macro which signs in an email confirmed user from clearance's factories. (Dan Croak) -* [#13] move private methods on sessions controller into Clearance::Authentication module (Dan Croak) -* [#9] audited flash keys. (Dan Croak) - -h2. 0.6.3 (04/23/2009) - -* Scoping ClearanceMailer properly within controllers so it works in production environments. (Nick Quaranto) - -h2. 0.6.2 (04/22/2009) - -* Insert Clearance::User into User model if it exists. (Nick Quaranto) -* World(NavigationHelpers) Cucumber 3.0 style. (Shay Arnett & Mark Cornick) - -h2. 0.6.1 (04/21/2009) -* Scope operators are necessary to keep Rails happy. Reverting the original -revert so they're back in the library now for constants referenced inside of -the gem. (Nick Quaranto) - -h2. 0.6.0 (04/21/2009) - -* Converted Clearance to a Rails engine. (Dan Croak & Joe Ferris) -* Include Clearance::User in User model in app. (Dan Croak & Joe Ferris) -* Include Clearance::Authentication in ApplicationController. (Dan Croak & Joe Ferris) -* Namespace controllers under Clearance. (Dan Croak & Joe Ferris) -* Routes move to engine, use namespaced controllers but publicly the same. (Dan Croak & Joe Ferris) -* If you want to override a controller, subclass it like SessionsController < -Clearance::SessionsController. This gives you access to usual hooks such as -url_after_create. (Dan Croak & Joe Ferris) -* Controllers, mailer, model, routes all unit tested inside engine. Use -script/generate clearance_features to test integration of Clearance with your -Rails app. No longer including modules in your app's test files. (Dan Croak & Joe Ferris) -* Moved views to engine. (Joe Ferris) -* Converted generated test/factories/clearance.rb to use inheritence for -email_confirmed_user. (Dan Croak) -* Corrected some spelling errors with methods (Nick Quaranto) -* Converted "I should see error messages" to use a regex in the features (Nick -Quaranto) -* Loading clearance routes after rails routes via some monkeypatching (Nick -Quaranto) -* Made the clearance controllers unloadable to stop constant loading errors in -development mode (Nick Quaranto) - -h2. 0.5.6 (4/11/2009) - -* [#57] Step definition changed for "User should see error messages" so -features won't fail for certain validations. (Nick Quaranto) - -h2. 0.5.5 (3/23/2009) - -* Removing duplicate test to get rid of warning. (Nick Quaranto) - -h2. 0.5.4 (3/21/2009) - -* When users fail logging in, redirect them instead of rendering. (Matt -Jankowski) - -h2. 0.5.3 (3/5/2009) - -* Clearance now works with (and requires) Shoulda 2.10.0. (Mark Cornick, Joe -Ferris, Dan Croak) -* Prefer flat over nested contexts in sessions_controller_test. (Joe Ferris, -Dan Croak) - -h2. 0.5.2 (3/2/2009) - -* Fixed last remaining errors in Rails 2.3 tests. Now fully compatible. (Joe -Ferris, Dan Croak) - -h2. 0.5.1 (2/27/2009) - -* [#46] A user with unconfirmed email who resets password now confirms email. -(Marcel Görner) -* Refactored user_from_cookie, user_from_session, User#authenticate to use -more direct return code instead of ugly, harder to read ternary. (Dan Croak) -* Switch order of cookies and sessions to take advantage of Rails 2.3's "Rack-based lazy-loaded sessions":http://is.gd/i23E. (Dan Croak) -* Altered generator to interact with application_controller.rb instead of -application.rb in Rails 2.3 apps. (Dan Croak) -* [#42] Bug fix. Rack-based session change altered how to test remember me -cookie. (Mihai Anca) - -h2. 0.5.0 (2/27/2009) - -* Fixed problem with Cucumber features. (Dan Croak) -* Fixed mising HTTP fluency use case. (Dan Croak) -* Refactored User#update_password to take just parameters it needs. (Dan -Croak) -* Refactored User unit tests to be more readable. (Dan Croak) - -h2. 0.4.9 (2/20/2009) - -* Protect passwords & confirmations actions with forbidden filters. (Dan Croak) -* Return 403 Forbidden status code in those cases. (Tim Pope) -* Test 403 Forbidden status code in Cucumber feature. (Dan Croak, Joe Ferris) -* Raise custom ActionController::Forbidden error internally. (Joe Ferris, Mike Burns, Jason Morrison) -* Test ActionController::Forbidden error is raised in functional test. (Joe Ferris, Mike Burns, Dan Croak) -* [#45] Fixed bug that allowed anyone to edit another user's password (Marcel Görner) -* Required Factory Girl >= 1.2.0. (Dan Croak) - -h2. 0.4.8 (2/16/2009) - -* Added support paths for Cucumber. (Ben Mabey) -* Added documentation for the flash. (Ben Mabey) -* Generators require "test_helper" instead of File.join. for rr compatibility. (Joe Ferris) -* Removed interpolated email address from flash message to make i18n easier. (Bence Nagy) -* Standardized flash messages that refer to email delivery. (Dan Croak) - -h2. 0.4.7 (2/12/2009) - -* Removed Clearance::Test::TestHelper so there is one less setup step. (Dan Croak) -* All test helpers now in shoulda_macros. (Dan Croak) - -h2. 0.4.6 (2/11/2009) - -* Made the modules behave like mixins again. (hat-tip Eloy Duran) -* Created Actions and PrivateMethods modules on controllers for future RDoc reasons. (Dan Croak, Joe Ferris) - -h2. 0.4.5 (2/9/2009) - -* [#43] Removed email downcasing because local-part is case sensitive per RFC5321. (Dan Croak) -* [#42] Removed dependency on Mocha. (Dan Croak) -* Required Shoulda >= 2.9.1. (Dan Croak) -* Added password reset feature to clearance_features generator. (Eugene Bolshakov, Dan Croak) -* Removed unnecessary session[:salt]. (Dan Croak) -* [#41] Only store location for session[:return_to] for GET requests. (Dan Croak) -* Audited "sign up" naming convention. "Register" had slipped in a few places. (Dan Croak) -* Switched to SHA1 encryption. Cypher doesn't matter much for email confirmation, password reset. Better to have shorter hashes in the emails for clients who line break on 72 chars. (Dan Croak) - -h2. 0.4.4 (2/2/2009) - -* Added a generator for Cucumber features. (Joe Ferris, Dan Croak) -* Standarized naming for "Sign up," "Sign in," and "Sign out". (Dan Croak) diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/LICENSE b/vendor/gems/thoughtbot-clearance-0.7.0/LICENSE deleted file mode 100644 index 5060183..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License - -Copyright (c) 2008 thoughtbot, inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/README.textile b/vendor/gems/thoughtbot-clearance-0.7.0/README.textile deleted file mode 100644 index 3aa3687..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/README.textile +++ /dev/null @@ -1,123 +0,0 @@ -h1. Clearance - -Rails authentication with email & password. - -"We have clearance, Clarence.":http://www.youtube.com/v/mNRXJEE3Nz8 - -h2. Wiki - -Most information regarding Clearance is on the "Github Wiki":http://wiki.github.com/thoughtbot/clearance. - -h2. Installation - -Clearance is a Rails engine. It works with versions of Rails greater than 2.3. - -In config/environment.rb: - -
-config.gem "thoughtbot-clearance", 
-  :lib     => 'clearance', 
-  :source  => 'http://gems.github.com', 
-  :version => '0.6.9'
-
- -Vendor the gem: - -
-rake gems:install
-rake gems:unpack
-
- -Make sure the development database exists and run the generator: - -@script/generate clearance@ - -A number of files will be created and instructions will be printed. - -You may already have some of these files. Don't worry. You'll be asked if you want to overwrite them. - -Run the migration: - -@rake db:migrate@ - -Define a HOST constant in your environment files. -In config/environments/test.rb and config/environments/development.rb it can be: - -@HOST = "localhost"@ - -In production.rb it must be the actual host your application is deployed to. -The constant is used by mailers to generate URLs in emails. - -In config/environment.rb: - -@DO_NOT_REPLY = "donotreply@example.com"@ - -Define root_url to *something* in your config/routes.rb: - -@map.root :controller => 'home'@ - -h2. Cucumber Features - -As your app evolves, you want to know that authentication still works. Clearance's opinion is that you should test its integration with your app using "Cucumber":http://cukes.info/. - -In config/environments/test.rb: - -
-config.gem 'webrat',
-  :version => '= 0.4.4'
-config.gem 'cucumber',
-  :version => '= 0.3.0'
-config.gem 'thoughtbot-factory_girl',
-  :lib     => 'factory_girl',
-  :source  => "http://gems.github.com", 
-  :version => '1.2.1'
-
- -Vendor the gems: - -
-rake gems:install RAILS_ENV=test
-rake gems:unpack  RAILS_ENV=test
-
- -We don't vendor nokogiri due to its native extensions, so install it normally on your machine: - -@sudo gem install nokogiri@ - -Run the Cucumber generator (if you haven't already) and Clearance's feature generator: - -
-script/generate cucumber
-script/generate clearance_features
-
- -All of the files generated should be new with the exception of the features/support/paths.rb file. If you have not modified your paths.rb then you will be okay to replace it with this one. If you need to keep your paths.rb file then add these locations in your paths.rb manually: - -
-def path_to(page_name)
-  case page_name
-   ...
-  when /the sign up page/i
-   new_user_path
-  when /the sign in page/i
-   new_session_path
-  when /the password reset request page/i
-   new_password_path
-  ...
-end
-
- -h2. Authors - -Clearance was extracted out of "Hoptoad":http://hoptoadapp.com. We merged the authentication code from two of thoughtbot's clients' Rails apps and have since used it each time we need authentication. The following people have improved the library. Thank you! - -Dan Croak, Mike Burns, Jason Morrison, Joe Ferris, Eugene Bolshakov, Nick Quaranto, Josh Nichols, Mike Breen, Marcel Görner, Bence Nagy, Ben Mabey, Eloy Duran, Tim Pope, Mihai Anca, Mark Cornick, Shay Arnett, Joshua Clayton & Mustafa Ekim. - -h2. Questions? - -Ask the "mailing list":http://groups.google.com/group/thoughtbot-clearance - -h2. Suggestions, Bugs, Refactoring? - -Fork away and create a "Github Issue":http://github.com/thoughtbot/clearance/issues. Please don't send pull requests. - diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/Rakefile b/vendor/gems/thoughtbot-clearance-0.7.0/Rakefile deleted file mode 100644 index cacfe35..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/Rakefile +++ /dev/null @@ -1,103 +0,0 @@ -# encoding: utf-8 - -require 'rake' -require 'rake/testtask' -require 'cucumber/rake/task' - -namespace :test do - Rake::TestTask.new(:basic => ["generator:cleanup", - "generator:clearance", - "generator:clearance_features"]) do |task| - task.libs << "lib" - task.libs << "test" - task.pattern = "test/**/*_test.rb" - task.verbose = false - end - - Rake::TestTask.new(:views => ["generator:clearance_views"]) do |task| - task.libs << "lib" - task.libs << "test" - task.pattern = "test/**/*_test.rb" - task.verbose = false - end - - Cucumber::Rake::Task.new(:features) do |t| - t.cucumber_opts = "--format progress" - t.feature_pattern = "test/rails_root/features/*.feature" - end - - Cucumber::Rake::Task.new(:features_for_views) do |t| - t.cucumber_opts = "--format progress" - t.feature_pattern = "test/rails_root/features/*.feature" - end -end - -generators = %w(clearance clearance_features clearance_views) - -namespace :generator do - desc "Cleans up the test app before running the generator" - task :cleanup do - generators.each do |generator| - FileList["generators/#{generator}/templates/**/*.*"].each do |each| - file = "test/rails_root/#{each.gsub("generators/#{generator}/templates/",'')}" - File.delete(file) if File.exists?(file) - end - end - - FileList["test/rails_root/db/**/*"].each do |each| - FileUtils.rm_rf(each) - end - - FileUtils.rm_rf("test/rails_root/vendor/plugins/clearance") - FileUtils.mkdir_p("test/rails_root/vendor/plugins") - clearance_root = File.expand_path(File.dirname(__FILE__)) - system("ln -s #{clearance_root} test/rails_root/vendor/plugins/clearance") - - FileUtils.rm_rf("test/rails_root/app/views/passwords") - FileUtils.rm_rf("test/rails_root/app/views/sessions") - FileUtils.rm_rf("test/rails_root/app/views/users") - end - - desc "Run the clearance generator" - task :clearance do - system "cd test/rails_root && ./script/generate clearance && rake db:migrate db:test:prepare" - end - - desc "Run the clearance features generator" - task :clearance_features do - system "cd test/rails_root && ./script/generate clearance_features" - end - - desc "Run the clearance views generator" - task :clearance_views do - system "cd test/rails_root && ./script/generate clearance_views" - end -end - -desc "Run the test suite" -task :default => ['test:basic', 'test:features', - 'test:views', 'test:features_for_views'] - -gem_spec = Gem::Specification.new do |gem_spec| - gem_spec.name = "clearance" - gem_spec.version = "0.7.0" - gem_spec.summary = "Rails authentication with email & password." - gem_spec.email = "support@thoughtbot.com" - gem_spec.homepage = "http://github.com/thoughtbot/clearance" - gem_spec.description = "Rails authentication with email & password." - gem_spec.authors = ["Dan Croak", "Mike Burns", "Jason Morrison", - "Joe Ferris", "Eugene Bolshakov", "Nick Quaranto", - "Josh Nichols", "Mike Breen", "Marcel Görner", - "Bence Nagy", "Ben Mabey", "Eloy Duran", - "Tim Pope", "Mihai Anca", "Mark Cornick", - "Shay Arnett"] - gem_spec.files = FileList["[A-Z]*", "{app,config,generators,lib,shoulda_macros,rails}/**/*"] -end - -desc "Generate a gemspec file" -task :gemspec do - File.open("#{gem_spec.name}.gemspec", 'w') do |f| - f.write gem_spec.to_yaml - end -end - diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/TODO.textile b/vendor/gems/thoughtbot-clearance-0.7.0/TODO.textile deleted file mode 100644 index 9805aed..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/TODO.textile +++ /dev/null @@ -1,6 +0,0 @@ -h1. To-do - -* Make insertion of Clearance::User into User model automatic from the generator. -* Change generated README to include instruction about running the migration. -* DO_NOT_REPLY, HOST refactoring. - diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/app/controllers/clearance/confirmations_controller.rb b/vendor/gems/thoughtbot-clearance-0.7.0/app/controllers/clearance/confirmations_controller.rb deleted file mode 100644 index 983e506..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/app/controllers/clearance/confirmations_controller.rb +++ /dev/null @@ -1,73 +0,0 @@ -class Clearance::ConfirmationsController < ApplicationController - unloadable - - before_filter :redirect_signed_in_confirmed_user, :only => [:new, :create] - before_filter :redirect_signed_out_confirmed_user, :only => [:new, :create] - before_filter :forbid_missing_token, :only => [:new, :create] - before_filter :forbid_non_existent_user, :only => [:new, :create] - - filter_parameter_logging :token - - def new - create - end - - def create - @user = ::User.find_by_id_and_token(params[:user_id], params[:token]) - @user.confirm_email! - - sign_in(@user) - flash_success_after_create - redirect_to(url_after_create) - end - - private - - def redirect_signed_in_confirmed_user - user = ::User.find_by_id(params[:user_id]) - if user && user.email_confirmed? && current_user == user - flash_success_after_create - redirect_to(url_after_create) - end - end - - def redirect_signed_out_confirmed_user - user = ::User.find_by_id(params[:user_id]) - if user && user.email_confirmed? && signed_out? - flash_already_confirmed - redirect_to(url_already_confirmed) - end - end - - def forbid_missing_token - if params[:token].blank? - raise ActionController::Forbidden, "missing token" - end - end - - def forbid_non_existent_user - unless ::User.find_by_id_and_token(params[:user_id], params[:token]) - raise ActionController::Forbidden, "non-existent user" - end - end - - def flash_success_after_create - flash[:success] = translate(:confirmed_email, - :scope => [:clearance, :controllers, :confirmations], - :default => "Confirmed email and signed in.") - end - - def flash_already_confirmed - flash[:success] = translate(:already_confirmed_email, - :scope => [:clearance, :controllers, :confirmations], - :default => "Already confirmed email. Please sign in.") - end - - def url_after_create - root_url - end - - def url_already_confirmed - sign_in_url - end -end diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/app/controllers/clearance/passwords_controller.rb b/vendor/gems/thoughtbot-clearance-0.7.0/app/controllers/clearance/passwords_controller.rb deleted file mode 100644 index 6221ad3..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/app/controllers/clearance/passwords_controller.rb +++ /dev/null @@ -1,81 +0,0 @@ -class Clearance::PasswordsController < ApplicationController - unloadable - - before_filter :forbid_missing_token, :only => [:edit, :update] - before_filter :forbid_non_existent_user, :only => [:edit, :update] - filter_parameter_logging :password, :password_confirmation - - def new - render :template => 'passwords/new' - end - - def create - if user = ::User.find_by_email(params[:password][:email]) - user.forgot_password! - ::ClearanceMailer.deliver_change_password user - flash_notice_after_create - redirect_to(url_after_create) - else - flash_failure_after_create - render :template => 'passwords/new' - end - end - - def edit - @user = ::User.find_by_id_and_token(params[:user_id], params[:token]) - render :template => 'passwords/edit' - end - - def update - @user = ::User.find_by_id_and_token(params[:user_id], params[:token]) - - if @user.update_password(params[:user][:password], - params[:user][:password_confirmation]) - @user.confirm_email! - sign_in(@user) - flash_success_after_update - redirect_to(url_after_update) - else - render :template => 'passwords/edit' - end - end - - private - - def forbid_missing_token - if params[:token].blank? - raise ActionController::Forbidden, "missing token" - end - end - - def forbid_non_existent_user - unless ::User.find_by_id_and_token(params[:user_id], params[:token]) - raise ActionController::Forbidden, "non-existent user" - end - end - - def flash_notice_after_create - flash[:notice] = translate(:deliver_change_password, - :scope => [:clearance, :controllers, :passwords], - :default => "You will receive an email within the next few minutes. " << - "It contains instructions for changing your password.") - end - - def flash_failure_after_create - flash.now[:failure] = translate(:unknown_email, - :scope => [:clearance, :controllers, :passwords], - :default => "Unknown email.") - end - - def url_after_create - new_session_url - end - - def flash_success_after_update - flash[:success] = translate(:signed_in, :default => "Signed in.") - end - - def url_after_update - root_url - end -end diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/app/controllers/clearance/sessions_controller.rb b/vendor/gems/thoughtbot-clearance-0.7.0/app/controllers/clearance/sessions_controller.rb deleted file mode 100644 index 2ea0440..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/app/controllers/clearance/sessions_controller.rb +++ /dev/null @@ -1,67 +0,0 @@ -class Clearance::SessionsController < ApplicationController - unloadable - - protect_from_forgery :except => :create - filter_parameter_logging :password - - def new - render :template => 'sessions/new' - end - - def create - @user = ::User.authenticate(params[:session][:email], - params[:session][:password]) - if @user.nil? - flash_failure_after_create - render :template => 'sessions/new', :status => :unauthorized - else - if @user.email_confirmed? - sign_in(@user) - remember(@user) if remember? - flash_success_after_create - redirect_back_or(url_after_create) - else - ::ClearanceMailer.deliver_confirmation(@user) - flash_notice_after_create - redirect_to(new_session_url) - end - end - end - - def destroy - forget(current_user) - flash_success_after_destroy - redirect_to(url_after_destroy) - end - - private - - def flash_failure_after_create - flash.now[:failure] = translate(:bad_email_or_password, - :scope => [:clearance, :controllers, :sessions], - :default => "Bad email or password.") - end - - def flash_success_after_create - flash[:success] = translate(:signed_in, :default => "Signed in.") - end - - def flash_notice_after_create - flash[:notice] = translate(:unconfirmed_email, - :scope => [:clearance, :controllers, :sessions], - :default => "User has not confirmed email. " << - "Confirmation email will be resent.") - end - - def url_after_create - root_url - end - - def flash_success_after_destroy - flash[:success] = translate(:signed_out, :default => "Signed out.") - end - - def url_after_destroy - new_session_url - end -end diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/app/controllers/clearance/users_controller.rb b/vendor/gems/thoughtbot-clearance-0.7.0/app/controllers/clearance/users_controller.rb deleted file mode 100644 index 6b8659e..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/app/controllers/clearance/users_controller.rb +++ /dev/null @@ -1,35 +0,0 @@ -class Clearance::UsersController < ApplicationController - unloadable - - before_filter :redirect_to_root, :only => [:new, :create], :if => :signed_in? - filter_parameter_logging :password - - def new - @user = ::User.new(params[:user]) - render :template => 'users/new' - end - - def create - @user = ::User.new params[:user] - if @user.save - ::ClearanceMailer.deliver_confirmation @user - flash_notice_after_create - redirect_to(url_after_create) - else - render :template => 'users/new' - end - end - - private - - def flash_notice_after_create - flash[:notice] = translate(:deliver_confirmation, - :scope => [:clearance, :controllers, :users], - :default => "You will receive an email within the next few minutes. " << - "It contains instructions for confirming your account.") - end - - def url_after_create - new_session_url - end -end diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/app/models/clearance_mailer.rb b/vendor/gems/thoughtbot-clearance-0.7.0/app/models/clearance_mailer.rb deleted file mode 100644 index 90f5f16..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/app/models/clearance_mailer.rb +++ /dev/null @@ -1,23 +0,0 @@ -class ClearanceMailer < ActionMailer::Base - - default_url_options[:host] = HOST - - def change_password(user) - from DO_NOT_REPLY - recipients user.email - subject I18n.t(:change_password, - :scope => [:clearance, :models, :clearance_mailer], - :default => "Change your password") - body :user => user - end - - def confirmation(user) - from DO_NOT_REPLY - recipients user.email - subject I18n.t(:confirmation, - :scope => [:clearance, :models, :clearance_mailer], - :default => "Account confirmation") - body :user => user - end - -end diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/app/views/clearance_mailer/change_password.html.erb b/vendor/gems/thoughtbot-clearance-0.7.0/app/views/clearance_mailer/change_password.html.erb deleted file mode 100644 index 246324d..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/app/views/clearance_mailer/change_password.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -Someone, hopefully you, has requested that we send you a link to change your password. - -Here's the link: - -<%= edit_user_password_url(@user, :token => @user.token, :escape => false) %> - -If you didn't request this, ignore this email. Don't worry. Your password hasn't been changed. diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/app/views/clearance_mailer/confirmation.html.erb b/vendor/gems/thoughtbot-clearance-0.7.0/app/views/clearance_mailer/confirmation.html.erb deleted file mode 100644 index 83d3de4..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/app/views/clearance_mailer/confirmation.html.erb +++ /dev/null @@ -1,2 +0,0 @@ - -<%= new_user_confirmation_url :user_id => @user, :token => @user.token, :encode => false %> diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/app/views/passwords/edit.html.erb b/vendor/gems/thoughtbot-clearance-0.7.0/app/views/passwords/edit.html.erb deleted file mode 100644 index c8637f5..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/app/views/passwords/edit.html.erb +++ /dev/null @@ -1,23 +0,0 @@ -

Change your password

- -

- Your password has been reset. Choose a new password below. -

- -<%= error_messages_for :user %> - -<% form_for(:user, - :url => user_password_path(@user, :token => @user.token), - :html => { :method => :put }) do |form| %> -
- <%= form.label :password, "Choose password" %> - <%= form.password_field :password %> -
-
- <%= form.label :password_confirmation, "Confirm password" %> - <%= form.password_field :password_confirmation %> -
-
- <%= form.submit "Save this password", :disable_with => "Please wait..." %> -
-<% end %> diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/app/views/passwords/new.html.erb b/vendor/gems/thoughtbot-clearance-0.7.0/app/views/passwords/new.html.erb deleted file mode 100644 index bd37d6d..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/app/views/passwords/new.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -

Change your password

- -

- We will email you a link to change your password. -

- -<% form_for :password, :url => passwords_path do |form| %> -
- <%= form.label :email, "Email address" %> - <%= form.text_field :email %> -
-
- <%= form.submit "Reset password", :disable_with => "Please wait..." %> -
-<% end %> \ No newline at end of file diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/app/views/sessions/new.html.erb b/vendor/gems/thoughtbot-clearance-0.7.0/app/views/sessions/new.html.erb deleted file mode 100644 index a1e5607..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/app/views/sessions/new.html.erb +++ /dev/null @@ -1,28 +0,0 @@ -

Sign in

- -<% form_for :session, :url => session_path do |form| %> -
- <%= form.label :email %> - <%= form.text_field :email %> -
-
- <%= form.label :password %> - <%= form.password_field :password %> -
-
- <%= form.check_box :remember_me %> - <%= form.label :remember_me %> -
-
- <%= form.submit "Sign in", :disable_with => "Please wait..." %> -
-<% end %> - - \ No newline at end of file diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/app/views/users/_form.html.erb b/vendor/gems/thoughtbot-clearance-0.7.0/app/views/users/_form.html.erb deleted file mode 100644 index 6a9b8e0..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/app/views/users/_form.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<%= form.error_messages %> -
- <%= form.label :email %> - <%= form.text_field :email %> -
-
- <%= form.label :password %> - <%= form.password_field :password %> -
-
- <%= form.label :password_confirmation, "Confirm password" %> - <%= form.password_field :password_confirmation %> -
\ No newline at end of file diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/app/views/users/new.html.erb b/vendor/gems/thoughtbot-clearance-0.7.0/app/views/users/new.html.erb deleted file mode 100644 index de2ebf7..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/app/views/users/new.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -

Sign up

- -<% form_for @user do |form| %> - <%= render :partial => '/users/form', :object => form %> - <%= form.submit 'Sign up', :disable_with => 'Please wait...' %> -<% end %> diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/config/clearance_routes.rb b/vendor/gems/thoughtbot-clearance-0.7.0/config/clearance_routes.rb deleted file mode 100644 index caeb5cc..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/config/clearance_routes.rb +++ /dev/null @@ -1,30 +0,0 @@ -ActionController::Routing::Routes.draw do |map| - map.resources :passwords, - :controller => 'clearance/passwords', - :only => [:new, :create] - - map.resource :session, - :controller => 'clearance/sessions', - :only => [:new, :create, :destroy] - - map.resources :users, :controller => 'clearance/users' do |users| - users.resource :password, - :controller => 'clearance/passwords', - :only => [:create, :edit, :update] - - users.resource :confirmation, - :controller => 'clearance/confirmations', - :only => [:new, :create] - end - - map.sign_up 'sign_up', - :controller => 'clearance/users', - :action => 'new' - map.sign_in 'sign_in', - :controller => 'clearance/sessions', - :action => 'new' - map.sign_out 'sign_out', - :controller => 'clearance/sessions', - :action => 'destroy', - :method => :delete -end diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/USAGE b/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/USAGE deleted file mode 100644 index 3d9cabe..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/USAGE +++ /dev/null @@ -1 +0,0 @@ -script/generate clearance \ No newline at end of file diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/clearance_generator.rb b/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/clearance_generator.rb deleted file mode 100644 index d3704b7..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/clearance_generator.rb +++ /dev/null @@ -1,41 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + "/lib/insert_commands.rb") -require File.expand_path(File.dirname(__FILE__) + "/lib/rake_commands.rb") -require 'factory_girl' - -class ClearanceGenerator < Rails::Generator::Base - - def manifest - record do |m| - m.insert_into "app/controllers/application_controller.rb", - "include Clearance::Authentication" - - user_model = "app/models/user.rb" - if File.exists?(user_model) - m.insert_into user_model, "include Clearance::User" - else - m.directory File.join("app", "models") - m.file "user.rb", user_model - end - - m.directory File.join("test", "factories") - m.file "factories.rb", "test/factories/clearance.rb" - - m.migration_template "migrations/#{migration_name}.rb", - 'db/migrate', - :migration_file_name => "clearance_#{migration_name}" - - m.readme "README" - end - end - - private - - def migration_name - if ActiveRecord::Base.connection.table_exists?(:users) - 'update_users' - else - 'create_users' - end - end - -end diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/lib/insert_commands.rb b/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/lib/insert_commands.rb deleted file mode 100644 index cc76c56..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/lib/insert_commands.rb +++ /dev/null @@ -1,33 +0,0 @@ -# Mostly pinched from http://github.com/ryanb/nifty-generators/tree/master - -Rails::Generator::Commands::Base.class_eval do - def file_contains?(relative_destination, line) - File.read(destination_path(relative_destination)).include?(line) - end -end - -Rails::Generator::Commands::Create.class_eval do - def insert_into(file, line) - logger.insert "#{line} into #{file}" - unless options[:pretend] || file_contains?(file, line) - gsub_file file, /^(class|module) .+$/ do |match| - "#{match}\n #{line}" - end - end - end -end - -Rails::Generator::Commands::Destroy.class_eval do - def insert_into(file, line) - logger.remove "#{line} from #{file}" - unless options[:pretend] - gsub_file file, "\n #{line}", '' - end - end -end - -Rails::Generator::Commands::List.class_eval do - def insert_into(file, line) - logger.insert "#{line} into #{file}" - end -end diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/lib/rake_commands.rb b/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/lib/rake_commands.rb deleted file mode 100644 index a9fd417..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/lib/rake_commands.rb +++ /dev/null @@ -1,22 +0,0 @@ -Rails::Generator::Commands::Create.class_eval do - def rake_db_migrate - logger.rake "db:migrate" - unless system("rake db:migrate") - logger.rake "db:migrate failed. Rolling back" - command(:destroy).invoke! - end - end -end - -Rails::Generator::Commands::Destroy.class_eval do - def rake_db_migrate - logger.rake "db:rollback" - system "rake db:rollback" - end -end - -Rails::Generator::Commands::List.class_eval do - def rake_db_migrate - logger.rake "db:migrate" - end -end diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/templates/README b/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/templates/README deleted file mode 100644 index 17850c8..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/templates/README +++ /dev/null @@ -1,22 +0,0 @@ - -******************************************************************************* - -Ok, enough fancy automatic stuff. Time for some old school monkey copy-pasting. - -1. Define a HOST constant in your environments files. -In config/environments/test.rb and config/environments/development.rb it can be: - - HOST = "localhost" - -In production.rb it must be the actual host your application is deployed to. -The constant is used by mailers to generate URLs in emails. - -2. In config/environment.rb: - - DO_NOT_REPLY = "donotreply@example.com" - -3. Define root_url to *something* in your config/routes.rb: - - map.root :controller => 'home' - -******************************************************************************* diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/templates/factories.rb b/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/templates/factories.rb deleted file mode 100644 index 9bdd13a..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/templates/factories.rb +++ /dev/null @@ -1,13 +0,0 @@ -Factory.sequence :email do |n| - "user#{n}@example.com" -end - -Factory.define :user do |user| - user.email { Factory.next :email } - user.password { "password" } - user.password_confirmation { "password" } -end - -Factory.define :email_confirmed_user, :parent => :user do |user| - user.email_confirmed { true } -end diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/templates/migrations/create_users.rb b/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/templates/migrations/create_users.rb deleted file mode 100644 index 22e921a..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/templates/migrations/create_users.rb +++ /dev/null @@ -1,21 +0,0 @@ -class ClearanceCreateUsers < ActiveRecord::Migration - def self.up - create_table(:users) do |t| - t.string :email - t.string :encrypted_password, :limit => 128 - t.string :salt, :limit => 128 - t.string :token, :limit => 128 - t.datetime :token_expires_at - t.boolean :email_confirmed, :default => false, :null => false - t.timestamps - end - - add_index :users, [:id, :token] - add_index :users, :email - add_index :users, :token - end - - def self.down - drop_table :users - end -end diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/templates/migrations/update_users.rb b/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/templates/migrations/update_users.rb deleted file mode 100644 index 4a329fa..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/templates/migrations/update_users.rb +++ /dev/null @@ -1,41 +0,0 @@ -class ClearanceUpdateUsers < ActiveRecord::Migration - def self.up -<% - existing_columns = ActiveRecord::Base.connection.columns(:users).collect { |each| each.name } - columns = [ - [:email, 't.string :email'], - [:encrypted_password, 't.string :encrypted_password, :limit => 128'], - [:salt, 't.string :salt, :limit => 128'], - [:token, 't.string :token, :limit => 128'], - [:token_expires_at, 't.datetime :token_expires_at'], - [:email_confirmed, 't.boolean :email_confirmed, :default => false, :null => false'] - ].delete_if {|c| existing_columns.include?(c.first.to_s)} --%> - change_table(:users) do |t| -<% columns.each do |c| -%> - <%= c.last %> -<% end -%> - end - -<% - existing_indexes = ActiveRecord::Base.connection.indexes(:users) - index_names = existing_indexes.collect { |each| each.name } - new_indexes = [ - [:index_users_on_id_and_token, 'add_index :users, [:id, :token]'], - [:index_users_on_email, 'add_index :users, :email'], - [:index_users_on_token, 'add_index :users, :token'] - ].delete_if { |each| index_names.include?(each.first.to_s) } --%> -<% new_indexes.each do |each| -%> - <%= each.last %> -<% end -%> - end - - def self.down - change_table(:users) do |t| -<% unless columns.empty? -%> - t.remove <%= columns.collect { |each| ":#{each.first}" }.join(',') %> -<% end -%> - end - end -end diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/templates/user.rb b/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/templates/user.rb deleted file mode 100644 index 6d077a1..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance/templates/user.rb +++ /dev/null @@ -1,3 +0,0 @@ -class User < ActiveRecord::Base - include Clearance::User -end diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/USAGE b/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/USAGE deleted file mode 100644 index 3758c0b..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/USAGE +++ /dev/null @@ -1 +0,0 @@ -script/generate clearance_features diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/clearance_features_generator.rb b/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/clearance_features_generator.rb deleted file mode 100644 index 477afd8..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/clearance_features_generator.rb +++ /dev/null @@ -1,20 +0,0 @@ -class ClearanceFeaturesGenerator < Rails::Generator::Base - - def manifest - record do |m| - m.directory File.join("features", "step_definitions") - m.directory File.join("features", "support") - - ["features/step_definitions/clearance_steps.rb", - "features/step_definitions/factory_girl_steps.rb", - "features/support/paths.rb", - "features/sign_in.feature", - "features/sign_out.feature", - "features/sign_up.feature", - "features/password_reset.feature"].each do |file| - m.file file, file - end - end - end - -end diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/password_reset.feature b/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/password_reset.feature deleted file mode 100644 index 51b77f7..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/password_reset.feature +++ /dev/null @@ -1,33 +0,0 @@ -Feature: Password reset - In order to sign in even if user forgot their password - A user - Should be able to reset it - - Scenario: User is not signed up - Given no user exists with an email of "email@person.com" - When I request password reset link to be sent to "email@person.com" - Then I should see "Unknown email" - - Scenario: User is signed up and requests password reset - Given I signed up with "email@person.com/password" - When I request password reset link to be sent to "email@person.com" - Then I should see "instructions for changing your password" - And a password reset message should be sent to "email@person.com" - - Scenario: User is signed up updated his password and types wrong confirmation - Given I signed up with "email@person.com/password" - When I follow the password reset link sent to "email@person.com" - And I update my password with "newpassword/wrongconfirmation" - Then I should see error messages - And I should be signed out - - Scenario: User is signed up and updates his password - Given I signed up with "email@person.com/password" - When I follow the password reset link sent to "email@person.com" - And I update my password with "newpassword/newpassword" - Then I should be signed in - When I sign out - Then I should be signed out - And I sign in as "email@person.com/newpassword" - Then I should be signed in - diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/sign_in.feature b/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/sign_in.feature deleted file mode 100644 index 4b44c39..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/sign_in.feature +++ /dev/null @@ -1,42 +0,0 @@ -Feature: Sign in - In order to get access to protected sections of the site - A user - Should be able to sign in - - Scenario: User is not signed up - Given no user exists with an email of "email@person.com" - When I go to the sign in page - And I sign in as "email@person.com/password" - Then I should see "Bad email or password" - And I should be signed out - - Scenario: User is not confirmed - Given I signed up with "email@person.com/password" - When I go to the sign in page - And I sign in as "email@person.com/password" - Then I should see "User has not confirmed email" - And I should be signed out - - Scenario: User enters wrong password - Given I am signed up and confirmed as "email@person.com/password" - When I go to the sign in page - And I sign in as "email@person.com/wrongpassword" - Then I should see "Bad email or password" - And I should be signed out - - Scenario: User signs in successfully - Given I am signed up and confirmed as "email@person.com/password" - When I go to the sign in page - And I sign in as "email@person.com/password" - Then I should see "Signed in" - And I should be signed in - - Scenario: User signs in and checks "remember me" - Given I am signed up and confirmed as "email@person.com/password" - When I go to the sign in page - And I sign in with "remember me" as "email@person.com/password" - Then I should see "Signed in" - And I should be signed in - When I return next time - Then I should be signed in - diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/sign_out.feature b/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/sign_out.feature deleted file mode 100644 index 2107226..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/sign_out.feature +++ /dev/null @@ -1,23 +0,0 @@ -Feature: Sign out - To protect my account from unauthorized access - A signed in user - Should be able to sign out - - Scenario: User signs out - Given I am signed up and confirmed as "email@person.com/password" - When I sign in as "email@person.com/password" - Then I should be signed in - And I sign out - Then I should see "Signed out" - And I should be signed out - - Scenario: User who was remembered signs out - Given I am signed up and confirmed as "email@person.com/password" - When I sign in with "remember me" as "email@person.com/password" - Then I should be signed in - And I sign out - Then I should see "Signed out" - And I should be signed out - When I return next time - Then I should be signed out - diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/sign_up.feature b/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/sign_up.feature deleted file mode 100644 index 4bb565d..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/sign_up.feature +++ /dev/null @@ -1,45 +0,0 @@ -Feature: Sign up - In order to get access to protected sections of the site - A user - Should be able to sign up - - Scenario: User signs up with invalid data - When I go to the sign up page - And I fill in "Email" with "invalidemail" - And I fill in "Password" with "password" - And I fill in "Confirm password" with "" - And I press "Sign Up" - Then I should see error messages - - Scenario: User signs up with valid data - When I go to the sign up page - And I fill in "Email" with "email@person.com" - And I fill in "Password" with "password" - And I fill in "Confirm password" with "password" - And I press "Sign Up" - Then I should see "instructions for confirming" - And a confirmation message should be sent to "email@person.com" - - Scenario: User confirms his account - Given I signed up with "email@person.com/password" - When I follow the confirmation link sent to "email@person.com" - Then I should see "Confirmed email and signed in" - And I should be signed in - - Scenario: Signed in user clicks confirmation link again - Given I signed up with "email@person.com/password" - When I follow the confirmation link sent to "email@person.com" - Then I should be signed in - When I follow the confirmation link sent to "email@person.com" - Then I should see "Confirmed email and signed in" - And I should be signed in - - Scenario: Signed out user clicks confirmation link again - Given I signed up with "email@person.com/password" - When I follow the confirmation link sent to "email@person.com" - Then I should be signed in - When I sign out - And I follow the confirmation link sent to "email@person.com" - Then I should see "Already confirmed email. Please sign in." - And I should be signed out - diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/step_definitions/clearance_steps.rb b/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/step_definitions/clearance_steps.rb deleted file mode 100644 index 52ac7f4..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/step_definitions/clearance_steps.rb +++ /dev/null @@ -1,110 +0,0 @@ -# General - -Then /^I should see error messages$/ do - assert_match /error(s)? prohibited/m, response.body -end - -# Database - -Given /^no user exists with an email of "(.*)"$/ do |email| - assert_nil User.find_by_email(email) -end - -Given /^I signed up with "(.*)\/(.*)"$/ do |email, password| - user = Factory :user, - :email => email, - :password => password, - :password_confirmation => password -end - -Given /^I am signed up and confirmed as "(.*)\/(.*)"$/ do |email, password| - user = Factory :email_confirmed_user, - :email => email, - :password => password, - :password_confirmation => password -end - -# Session - -Then /^I should be signed in$/ do - assert controller.signed_in? -end - -Then /^I should be signed out$/ do - assert ! controller.signed_in? -end - -When /^session is cleared$/ do - request.reset_session - controller.instance_variable_set(:@_current_user, nil) -end - -# Emails - -Then /^a confirmation message should be sent to "(.*)"$/ do |email| - user = User.find_by_email(email) - sent = ActionMailer::Base.deliveries.first - assert_equal [user.email], sent.to - assert_match /confirm/i, sent.subject - assert !user.token.blank? - assert_match /#{user.token}/, sent.body -end - -When /^I follow the confirmation link sent to "(.*)"$/ do |email| - user = User.find_by_email(email) - visit new_user_confirmation_path(:user_id => user, :token => user.token) -end - -Then /^a password reset message should be sent to "(.*)"$/ do |email| - user = User.find_by_email(email) - sent = ActionMailer::Base.deliveries.first - assert_equal [user.email], sent.to - assert_match /password/i, sent.subject - assert !user.token.blank? - assert_match /#{user.token}/, sent.body -end - -When /^I follow the password reset link sent to "(.*)"$/ do |email| - user = User.find_by_email(email) - visit edit_user_password_path(:user_id => user, :token => user.token) -end - -When /^I try to change the password of "(.*)" without token$/ do |email| - user = User.find_by_email(email) - visit edit_user_password_path(:user_id => user) -end - -Then /^I should be forbidden$/ do - assert_response :forbidden -end - -# Actions - -When /^I sign in( with "remember me")? as "(.*)\/(.*)"$/ do |remember, email, password| - When %{I go to the sign in page} - And %{I fill in "Email" with "#{email}"} - And %{I fill in "Password" with "#{password}"} - And %{I check "Remember me"} if remember - And %{I press "Sign In"} -end - -When /^I sign out$/ do - visit '/session', :delete -end - -When /^I request password reset link to be sent to "(.*)"$/ do |email| - When %{I go to the password reset request page} - And %{I fill in "Email address" with "#{email}"} - And %{I press "Reset password"} -end - -When /^I update my password with "(.*)\/(.*)"$/ do |password, confirmation| - And %{I fill in "Choose password" with "#{password}"} - And %{I fill in "Confirm password" with "#{confirmation}"} - And %{I press "Save this password"} -end - -When /^I return next time$/ do - When %{session is cleared} - And %{I go to the homepage} -end diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/step_definitions/factory_girl_steps.rb b/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/step_definitions/factory_girl_steps.rb deleted file mode 100644 index 6337f66..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/step_definitions/factory_girl_steps.rb +++ /dev/null @@ -1,5 +0,0 @@ -Factory.factories.each do |name, factory| - Given /^an? #{name} exists with an? (.*) of "([^"]*)"$/ do |attr, value| - Factory(name, attr.gsub(' ', '_') => value) - end -end diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/support/paths.rb b/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/support/paths.rb deleted file mode 100644 index 62ba3d5..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_features/templates/features/support/paths.rb +++ /dev/null @@ -1,22 +0,0 @@ -module NavigationHelpers - def path_to(page_name) - case page_name - - when /the homepage/i - root_path - when /the sign up page/i - new_user_path - when /the sign in page/i - new_session_path - when /the password reset request page/i - new_password_path - - # Add more page name => path mappings here - - else - raise "Can't find mapping from \"#{page_name}\" to a path." - end - end -end - -World(NavigationHelpers) diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/USAGE b/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/USAGE deleted file mode 100644 index e69de29..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/USAGE +++ /dev/null diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/clearance_views_generator.rb b/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/clearance_views_generator.rb deleted file mode 100644 index 6075ed8..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/clearance_views_generator.rb +++ /dev/null @@ -1,27 +0,0 @@ -class ClearanceViewsGenerator < Rails::Generator::Base - - def manifest - record do |m| - strategy = "formtastic" - template_strategy = "erb" - - m.directory File.join("app", "views", "users") - m.file "#{strategy}/users/new.html.#{template_strategy}", - "app/views/users/new.html.#{template_strategy}" - m.file "#{strategy}/users/_inputs.html.#{template_strategy}", - "app/views/users/_inputs.html.#{template_strategy}" - - m.directory File.join("app", "views", "sessions") - m.file "#{strategy}/sessions/new.html.#{template_strategy}", - "app/views/sessions/new.html.#{template_strategy}" - - m.directory File.join("app", "views", "passwords") - m.file "#{strategy}/passwords/new.html.#{template_strategy}", - "app/views/passwords/new.html.#{template_strategy}" - m.file "#{strategy}/passwords/edit.html.#{template_strategy}", - "app/views/passwords/edit.html.#{template_strategy}" - end - end - -end - diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/templates/formtastic/passwords/edit.html.erb b/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/templates/formtastic/passwords/edit.html.erb deleted file mode 100644 index 9cb7112..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/templates/formtastic/passwords/edit.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -

Change your password

- -

- Your password has been reset. Choose a new password below. -

- -<% semantic_form_for(:user, - :url => user_password_path(@user, :token => @user.token), - :html => { :method => :put }) do |form| %> - <%= form.error_messages %> - <% form.inputs do -%> - <%= form.input :password, :as => :password, - :label => "Choose password" %> - <%= form.input :password_confirmation, :as => :password, - :label => "Confirm password" %> - <% end -%> - <% form.buttons do -%> - <%= form.commit_button "Save this password" %> - <% end -%> -<% end %> - diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/templates/formtastic/passwords/new.html.erb b/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/templates/formtastic/passwords/new.html.erb deleted file mode 100644 index 4ac1269..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/templates/formtastic/passwords/new.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -

Reset your password

- -

- We will email you a link to reset your password. -

- -<% semantic_form_for :password, :url => passwords_path do |form| -%> - <% form.inputs do -%> - <%= form.input :email, :label => "Email address" %> - <% end -%> - <% form.buttons do -%> - <%= form.commit_button "Reset password" %> - <% end -%> -<% end -%> - diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/templates/formtastic/sessions/new.html.erb b/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/templates/formtastic/sessions/new.html.erb deleted file mode 100644 index ad86f71..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/templates/formtastic/sessions/new.html.erb +++ /dev/null @@ -1,22 +0,0 @@ -

Sign in

- -<% semantic_form_for :session, :url => session_path do |form| %> - <% form.inputs do %> - <%= form.input :email %> - <%= form.input :password, :as => :password %> - <%= form.input :remember_me, :as => :boolean, :required => false %> - <% end %> - <% form.buttons do %> - <%= form.commit_button "Sign in" %> - <% end %> -<% end %> - - - diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/templates/formtastic/users/_inputs.html.erb b/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/templates/formtastic/users/_inputs.html.erb deleted file mode 100644 index aff7908..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/templates/formtastic/users/_inputs.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -<% form.inputs do %> - <%= form.input :email %> - <%= form.input :password %> - <%= form.input :password_confirmation, :label => "Confirm password" %> -<% end %> - diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/templates/formtastic/users/new.html.erb b/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/templates/formtastic/users/new.html.erb deleted file mode 100644 index be7f1dc..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/generators/clearance_views/templates/formtastic/users/new.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -

Sign up

- -<% semantic_form_for @user do |form| %> - <%= form.error_messages %> - <%= render :partial => "/users/inputs", :locals => { :form => form } %> - <% form.buttons do %> - <%= form.commit_button "Sign up" %> - <% end %> -<% end %> - diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance.rb b/vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance.rb deleted file mode 100644 index 260c4d6..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance.rb +++ /dev/null @@ -1,6 +0,0 @@ -require 'clearance/extensions/errors' -require 'clearance/extensions/rescue' -require 'clearance/extensions/routes' - -require 'clearance/authentication' -require 'clearance/user' diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance/authentication.rb b/vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance/authentication.rb deleted file mode 100644 index 303ffd6..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance/authentication.rb +++ /dev/null @@ -1,102 +0,0 @@ -module Clearance - module Authentication - - def self.included(controller) - controller.send(:include, InstanceMethods) - - controller.class_eval do - helper_method :current_user, :signed_in?, :signed_out? - hide_action :current_user, :signed_in?, :signed_out? - end - end - - module InstanceMethods - def current_user - @_current_user ||= (user_from_cookie || user_from_session) - end - - def signed_in? - ! current_user.nil? - end - - def signed_out? - current_user.nil? - end - - protected - - def authenticate - deny_access unless signed_in? - end - - def user_from_session - if session[:user_id] - return nil unless user = ::User.find_by_id(session[:user_id]) - return user if user.email_confirmed? - end - end - - def user_from_cookie - if token = cookies[:remember_token] - return nil unless user = ::User.find_by_token(token) - return user if user.remember? - end - end - - def sign_user_in(user) - warn "[DEPRECATION] sign_user_in: unnecessary. use sign_in(user) instead." - sign_in(user) - end - - def sign_in(user) - if user - session[:user_id] = user.id - end - end - - def remember? - params[:session] && params[:session][:remember_me] == "1" - end - - def remember(user) - user.remember_me! - cookies[:remember_token] = { :value => user.token, - :expires => user.token_expires_at } - end - - def forget(user) - user.forget_me! if user - cookies.delete(:remember_token) - reset_session - end - - def redirect_back_or(default) - redirect_to(return_to || default) - clear_return_to - end - - def return_to - session[:return_to] || params[:return_to] - end - - def clear_return_to - session[:return_to] = nil - end - - def redirect_to_root - redirect_to(root_url) - end - - def store_location - session[:return_to] = request.request_uri if request.get? - end - - def deny_access(flash_message = nil, opts = {}) - store_location - flash[:failure] = flash_message if flash_message - redirect_to(new_session_url) - end - end - - end -end diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance/extensions/errors.rb b/vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance/extensions/errors.rb deleted file mode 100644 index d6b19bf..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance/extensions/errors.rb +++ /dev/null @@ -1,6 +0,0 @@ -if defined?(ActionController) - module ActionController - class Forbidden < StandardError - end - end -end diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance/extensions/rescue.rb b/vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance/extensions/rescue.rb deleted file mode 100644 index 7afe4ad..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance/extensions/rescue.rb +++ /dev/null @@ -1,3 +0,0 @@ -if defined?(ActionController::Base) - ActionController::Base.rescue_responses.update('ActionController::Forbidden' => :forbidden) -end diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance/extensions/routes.rb b/vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance/extensions/routes.rb deleted file mode 100644 index 1a6c43b..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance/extensions/routes.rb +++ /dev/null @@ -1,14 +0,0 @@ -if defined?(ActionController::Routing::RouteSet) - class ActionController::Routing::RouteSet - def load_routes_with_clearance! - lib_path = File.dirname(__FILE__) - clearance_routes = File.join(lib_path, *%w[.. .. .. config clearance_routes.rb]) - unless configuration_files.include?(clearance_routes) - add_configuration_file(clearance_routes) - end - load_routes_without_clearance! - end - - alias_method_chain :load_routes!, :clearance - end -end diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance/user.rb b/vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance/user.rb deleted file mode 100644 index f6206e9..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/lib/clearance/user.rb +++ /dev/null @@ -1,143 +0,0 @@ -require 'digest/sha1' - -module Clearance - module User - - def self.included(model) - model.extend(ClassMethods) - - model.send(:include, InstanceMethods) - model.send(:include, AttrAccessible) - model.send(:include, AttrAccessor) - model.send(:include, Validations) - model.send(:include, Callbacks) - end - - module AttrAccessible - def self.included(model) - model.class_eval do - attr_accessible :email, :password, :password_confirmation - end - end - end - - module AttrAccessor - def self.included(model) - model.class_eval do - attr_accessor :password, :password_confirmation - end - end - end - - module Validations - def self.included(model) - model.class_eval do - validates_presence_of :email - validates_uniqueness_of :email, :case_sensitive => false - validates_format_of :email, :with => %r{.+@.+\..+} - - validates_presence_of :password, :if => :password_required? - validates_confirmation_of :password, :if => :password_required? - end - end - end - - module Callbacks - def self.included(model) - model.class_eval do - before_save :initialize_salt, :encrypt_password, :initialize_token - end - end - end - - module InstanceMethods - def authenticated?(password) - encrypted_password == encrypt(password) - end - - def encrypt(string) - generate_hash("--#{salt}--#{string}--") - end - - def remember? - token_expires_at && Time.now.utc < token_expires_at - end - - def remember_me! - remember_me_until! 2.weeks.from_now.utc - end - - def forget_me! - clear_token - save(false) - end - - def confirm_email! - self.email_confirmed = true - self.token = nil - save(false) - end - - def forgot_password! - generate_token - save(false) - end - - def update_password(new_password, new_password_confirmation) - self.password = new_password - self.password_confirmation = new_password_confirmation - clear_token if valid? - save - end - - protected - - def generate_hash(string) - Digest::SHA1.hexdigest(string) - end - - def initialize_salt - if new_record? - self.salt = generate_hash("--#{Time.now.utc.to_s}--#{password}--") - end - end - - def encrypt_password - return if password.blank? - self.encrypted_password = encrypt(password) - end - - def generate_token - self.token = encrypt("--#{Time.now.utc.to_s}--#{password}--") - self.token_expires_at = nil - end - - def clear_token - self.token = nil - self.token_expires_at = nil - end - - def initialize_token - generate_token if new_record? - end - - def password_required? - encrypted_password.blank? || !password.blank? - end - - def remember_me_until!(time) - self.token_expires_at = time - self.token = encrypt("--#{token_expires_at}--#{password}--") - save(false) - end - end - - module ClassMethods - def authenticate(email, password) - return nil unless user = find_by_email(email) - return user if user.authenticated?(password) - end - end - - end -end diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/rails/init.rb b/vendor/gems/thoughtbot-clearance-0.7.0/rails/init.rb deleted file mode 100644 index 5ed1d1b..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/rails/init.rb +++ /dev/null @@ -1 +0,0 @@ -require 'clearance' \ No newline at end of file diff --git a/vendor/gems/thoughtbot-clearance-0.7.0/shoulda_macros/clearance.rb b/vendor/gems/thoughtbot-clearance-0.7.0/shoulda_macros/clearance.rb deleted file mode 100644 index 10bc99c..0000000 --- a/vendor/gems/thoughtbot-clearance-0.7.0/shoulda_macros/clearance.rb +++ /dev/null @@ -1,268 +0,0 @@ -module Clearance - module Shoulda - - # STATE OF AUTHENTICATION - - def should_be_signed_in_as(&block) - should "be signed in as #{block.bind(self).call}" do - user = block.bind(self).call - assert_not_nil user, - "please pass a User. try: should_be_signed_in_as { @user }" - assert_equal user, @controller.send(:current_user), - "#{user.inspect} is not the current_user, " << - "which is #{@controller.send(:current_user).inspect}" - end - end - - def should_be_signed_in_and_email_confirmed_as(&block) - warn "[DEPRECATION] should_be_signed_in_and_email_confirmed_as: questionable usefulness" - should_be_signed_in_as &block - - should "have confirmed email" do - user = block.bind(self).call - - assert_not_nil user - assert_equal user, assigns(:user) - assert assigns(:user).email_confirmed? - end - end - - def should_not_be_signed_in - should "not be signed in" do - assert_nil session[:user_id] - end - end - - def should_deny_access_on(http_method, action, opts = {}) - warn "[DEPRECATION] should_deny_access_on: use a setup & should_deny_access(:flash => ?)" - flash_message = opts.delete(:flash) - context "on #{http_method} to #{action}" do - setup do - send(http_method, action, opts) - end - - should_deny_access(:flash => flash_message) - end - end - - def should_deny_access(opts = {}) - if opts[:flash] - should_set_the_flash_to opts[:flash] - else - should_not_set_the_flash - end - - should_redirect_to('new_session_url') { new_session_url } - end - - # HTTP FLUENCY - - def should_forbid(description, &block) - should "forbid #{description}" do - assert_raises ActionController::Forbidden do - instance_eval(&block) - end - end - end - - # CONTEXTS - - def signed_in_user_context(&blk) - warn "[DEPRECATION] signed_in_user_context: creates a Mystery Guest, causes Obscure Test" - context "A signed in user" do - setup do - @user = Factory(:user) - @user.confirm_email! - sign_in_as @user - end - merge_block(&blk) - end - end - - def public_context(&blk) - warn "[DEPRECATION] public_context: common case is no-op. call sign_out otherwise" - context "The public" do - setup { sign_out } - merge_block(&blk) - end - end - - # CREATING USERS - - def should_create_user_successfully - warn "[DEPRECATION] should_create_user_successfully: not meant to be public, no longer used internally" - should_assign_to :user - should_change 'User.count', :by => 1 - - should "send the confirmation email" do - assert_sent_email do |email| - email.subject =~ /account confirmation/i - end - end - - should_set_the_flash_to /confirm/i - should_redirect_to_url_after_create - end - - # RENDERING - - def should_render_nothing - should "render nothing" do - assert @response.body.blank? - end - end - - # REDIRECTS - - def should_redirect_to_url_after_create - should_redirect_to("the post-create url") do - @controller.send(:url_after_create) - end - end - - def should_redirect_to_url_after_update - should_redirect_to("the post-update url") do - @controller.send(:url_after_update) - end - end - - def should_redirect_to_url_after_destroy - should_redirect_to("the post-destroy url") do - @controller.send(:url_after_destroy) - end - end - - def should_redirect_to_url_already_confirmed - should_redirect_to("the already confirmed url") do - @controller.send(:url_already_confirmed) - end - end - - # VALIDATIONS - - def should_validate_confirmation_of(attribute, opts = {}) - warn "[DEPRECATION] should_validate_confirmation_of: not meant to be public, no longer used internally" - raise ArgumentError if opts[:factory].nil? - - context "on save" do - should_validate_confirmation_is_not_blank opts[:factory], attribute - should_validate_confirmation_is_not_bad opts[:factory], attribute - end - end - - def should_validate_confirmation_is_not_blank(factory, attribute, opts = {}) - warn "[DEPRECATION] should_validate_confirmation_is_not_blank: not meant to be public, no longer used internally" - should "validate #{attribute}_confirmation is not blank" do - model = Factory.build(factory, blank_confirmation_options(attribute)) - model.save - assert_confirmation_error(model, attribute, - "#{attribute}_confirmation cannot be blank") - end - end - - def should_validate_confirmation_is_not_bad(factory, attribute, opts = {}) - warn "[DEPRECATION] should_validate_confirmation_is_not_bad: not meant to be public, no longer used internally" - should "validate #{attribute}_confirmation is different than #{attribute}" do - model = Factory.build(factory, bad_confirmation_options(attribute)) - model.save - assert_confirmation_error(model, attribute, - "#{attribute}_confirmation cannot be different than #{attribute}") - end - end - - # FORMS - - def should_display_a_password_update_form - warn "[DEPRECATION] should_display_a_password_update_form: not meant to be public, no longer used internally" - should "have a form for the user's token, password, and password confirm" do - update_path = ERB::Util.h( - user_password_path(@user, :token => @user.token) - ) - - assert_select 'form[action=?]', update_path do - assert_select 'input[name=_method][value=?]', 'put' - assert_select 'input[name=?]', 'user[password]' - assert_select 'input[name=?]', 'user[password_confirmation]' - end - end - end - - def should_display_a_sign_up_form - warn "[DEPRECATION] should_display_a_sign_up_form: not meant to be public, no longer used internally" - should "display a form to sign up" do - assert_select "form[action=#{users_path}][method=post]", - true, "There must be a form to sign up" do - assert_select "input[type=text][name=?]", - "user[email]", true, "There must be an email field" - assert_select "input[type=password][name=?]", - "user[password]", true, "There must be a password field" - assert_select "input[type=password][name=?]", - "user[password_confirmation]", true, "There must be a password confirmation field" - assert_select "input[type=submit]", true, - "There must be a submit button" - end - end - end - - def should_display_a_sign_in_form - warn "[DEPRECATION] should_display_a_sign_in_form: not meant to be public, no longer used internally" - should 'display a "sign in" form' do - assert_select "form[action=#{session_path}][method=post]", - true, "There must be a form to sign in" do - assert_select "input[type=text][name=?]", - "session[email]", true, "There must be an email field" - assert_select "input[type=password][name=?]", - "session[password]", true, "There must be a password field" - assert_select "input[type=checkbox][name=?]", - "session[remember_me]", true, "There must be a 'remember me' check box" - assert_select "input[type=submit]", true, - "There must be a submit button" - end - end - end - end -end - -module Clearance - module Shoulda - module Helpers - def sign_in_as(user) - @controller.class_eval { attr_accessor :current_user } - @controller.current_user = user - return user - end - - def sign_in - sign_in_as Factory(:email_confirmed_user) - end - - def sign_out - @controller.class_eval { attr_accessor :current_user } - @controller.current_user = nil - end - - def blank_confirmation_options(attribute) - warn "[DEPRECATION] blank_confirmation_options: not meant to be public, no longer used internally" - opts = { attribute => attribute.to_s } - opts.merge("#{attribute}_confirmation".to_sym => "") - end - - def bad_confirmation_options(attribute) - warn "[DEPRECATION] bad_confirmation_options: not meant to be public, no longer used internally" - opts = { attribute => attribute.to_s } - opts.merge("#{attribute}_confirmation".to_sym => "not_#{attribute}") - end - - def assert_confirmation_error(model, attribute, message = "confirmation error") - warn "[DEPRECATION] assert_confirmation_error: not meant to be public, no longer used internally" - assert model.errors.on(attribute).include?("doesn't match confirmation"), - message - end - end - end -end - -class Test::Unit::TestCase - include Clearance::Shoulda::Helpers -end -Test::Unit::TestCase.extend(Clearance::Shoulda) diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/CHANGELOG.textile b/vendor/gems/thoughtbot-clearance-0.8.2/CHANGELOG.textile new file mode 100644 index 0000000..c434b96 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/CHANGELOG.textile @@ -0,0 +1,194 @@ +h2. 0.8.2 (09/01/2009) + +* current_user= accessor method. (Joe Ferris, Josh Clayton) +* set current_user in sign_in. (Jon Yurek) + +h2. 0.8.1 (08/31/2009) + +* Removed unnecessary remember_token_expires_at column and the +remember? and forget_me! user instance methods. (Dan Croak) + +h2. 0.8.0 (08/31/2009) + +* Always remember me. Replaced session-and-remember-me authentication with +always using a cookie with a long timeout. (Dan Croak) +* Documented Clearance::Authentication with YARD. (Dan Croak) +* Documented Clearance::User with YARD. (Dan Croak) + +h2. 0.7.0 (08/04/2009) + +* Redirect signed in user who clicks confirmation link again. (Dan Croak) +* Redirect signed out user who clicks confirmation link again. (Dan Croak) +* Added signed_out? convenience method for controllers, helpers, views. (Dan +Croak) +* Added clearance_views generator. By default, creates formtastic views which +pass all tests and features. (Dan Croak) + +h2. 0.6.9 (07/04/2009) + +* Added timestamps to create users migration. (Dan Croak) +* Ready for Ruby 1.9. (Jason Morrison, Nick Quaranto) + +h2. 0.6.8 (06/24/2009) + +* Added defined? checks for various Rails constants such as ActionController +for easier unit testing of Clearance extensions... particularly ActiveRecord +extensions... particularly strong_password. (Dan Croak) + +h2. 0.6.7 (06/13/2009) + +* [#30] Added sign_up, sign_in, sign_out named routes. (Dan Croak) +* [#22] Minimizing Reek smell: Duplication in redirect_back_or. (Dan Croak) +* Deprecated sign_user_in. Told developers to use sign_in instead. (Dan +Croak) +* [#16] flash_success_after_create, flash_notice_after_create, flash_failure_after_create, flash_sucess_after_update, flash_success_after_destroy, etc. (Dan Croak) +* [#17] bug. added #create to forbidden before_filters on confirmations controller. (Dan Croak) +* [#24] should_be_signed_in_as shouldn't look in the session. (Dan Croak) +* README improvements. (Dan Croak) +* Move routes loading to separate file. (Joshua Clayton) + +h2. 0.6.6 (05/18/2009) + +* [#14] replaced class_eval in Clearance::User with modules. This was needed +in a thoughtbot client app so we could write our own validations. (Dan Croak) + +h2. 0.6.5 (05/17/2009) + +* [#6] Make Clearance i18n aware. (Timur Vafin, Marcel Goerner, Eugene Bolshakov, Dan Croak) + +h2. 0.6.4 (05/12/2009) + +* Moved issue tracking to Github from Lighthouse. (Dan Croak) +* [#7] asking higher-level questions of controllers in webrat steps, such as signed_in? instead of what's in the session. same for accessors. (Dan Croak) +* [#11] replacing sign_in_as & sign_out shoulda macros with a stubbing (requires no dependency) approach. this will avoid dealing with the internals of current_user, such as session & cookies. added sign_in macro which signs in an email confirmed user from clearance's factories. (Dan Croak) +* [#13] move private methods on sessions controller into Clearance::Authentication module (Dan Croak) +* [#9] audited flash keys. (Dan Croak) + +h2. 0.6.3 (04/23/2009) + +* Scoping ClearanceMailer properly within controllers so it works in production environments. (Nick Quaranto) + +h2. 0.6.2 (04/22/2009) + +* Insert Clearance::User into User model if it exists. (Nick Quaranto) +* World(NavigationHelpers) Cucumber 3.0 style. (Shay Arnett & Mark Cornick) + +h2. 0.6.1 (04/21/2009) + +* Scope operators are necessary to keep Rails happy. Reverting the original +revert so they're back in the library now for constants referenced inside of +the gem. (Nick Quaranto) + +h2. 0.6.0 (04/21/2009) + +* Converted Clearance to a Rails engine. (Dan Croak & Joe Ferris) +* Include Clearance::User in User model in app. (Dan Croak & Joe Ferris) +* Include Clearance::Authentication in ApplicationController. (Dan Croak & Joe Ferris) +* Namespace controllers under Clearance. (Dan Croak & Joe Ferris) +* Routes move to engine, use namespaced controllers but publicly the same. (Dan Croak & Joe Ferris) +* If you want to override a controller, subclass it like SessionsController < +Clearance::SessionsController. This gives you access to usual hooks such as +url_after_create. (Dan Croak & Joe Ferris) +* Controllers, mailer, model, routes all unit tested inside engine. Use +script/generate clearance_features to test integration of Clearance with your +Rails app. No longer including modules in your app's test files. (Dan Croak & Joe Ferris) +* Moved views to engine. (Joe Ferris) +* Converted generated test/factories/clearance.rb to use inheritence for +email_confirmed_user. (Dan Croak) +* Corrected some spelling errors with methods (Nick Quaranto) +* Converted "I should see error messages" to use a regex in the features (Nick +Quaranto) +* Loading clearance routes after rails routes via some monkeypatching (Nick +Quaranto) +* Made the clearance controllers unloadable to stop constant loading errors in +development mode (Nick Quaranto) + +h2. 0.5.6 (4/11/2009) + +* [#57] Step definition changed for "User should see error messages" so +features won't fail for certain validations. (Nick Quaranto) + +h2. 0.5.5 (3/23/2009) + +* Removing duplicate test to get rid of warning. (Nick Quaranto) + +h2. 0.5.4 (3/21/2009) + +* When users fail logging in, redirect them instead of rendering. (Matt +Jankowski) + +h2. 0.5.3 (3/5/2009) + +* Clearance now works with (and requires) Shoulda 2.10.0. (Mark Cornick, Joe +Ferris, Dan Croak) +* Prefer flat over nested contexts in sessions_controller_test. (Joe Ferris, +Dan Croak) + +h2. 0.5.2 (3/2/2009) + +* Fixed last remaining errors in Rails 2.3 tests. Now fully compatible. (Joe +Ferris, Dan Croak) + +h2. 0.5.1 (2/27/2009) + +* [#46] A user with unconfirmed email who resets password now confirms email. +(Marcel Görner) +* Refactored user_from_cookie, user_from_session, User#authenticate to use +more direct return code instead of ugly, harder to read ternary. (Dan Croak) +* Switch order of cookies and sessions to take advantage of Rails 2.3's "Rack-based lazy-loaded sessions":http://is.gd/i23E. (Dan Croak) +* Altered generator to interact with application_controller.rb instead of +application.rb in Rails 2.3 apps. (Dan Croak) +* [#42] Bug fix. Rack-based session change altered how to test remember me +cookie. (Mihai Anca) + +h2. 0.5.0 (2/27/2009) + +* Fixed problem with Cucumber features. (Dan Croak) +* Fixed mising HTTP fluency use case. (Dan Croak) +* Refactored User#update_password to take just parameters it needs. (Dan +Croak) +* Refactored User unit tests to be more readable. (Dan Croak) + +h2. 0.4.9 (2/20/2009) + +* Protect passwords & confirmations actions with forbidden filters. (Dan Croak) +* Return 403 Forbidden status code in those cases. (Tim Pope) +* Test 403 Forbidden status code in Cucumber feature. (Dan Croak, Joe Ferris) +* Raise custom ActionController::Forbidden error internally. (Joe Ferris, Mike Burns, Jason Morrison) +* Test ActionController::Forbidden error is raised in functional test. (Joe Ferris, Mike Burns, Dan Croak) +* [#45] Fixed bug that allowed anyone to edit another user's password (Marcel Görner) +* Required Factory Girl >= 1.2.0. (Dan Croak) + +h2. 0.4.8 (2/16/2009) + +* Added support paths for Cucumber. (Ben Mabey) +* Added documentation for the flash. (Ben Mabey) +* Generators require "test_helper" instead of File.join. for rr compatibility. (Joe Ferris) +* Removed interpolated email address from flash message to make i18n easier. (Bence Nagy) +* Standardized flash messages that refer to email delivery. (Dan Croak) + +h2. 0.4.7 (2/12/2009) + +* Removed Clearance::Test::TestHelper so there is one less setup step. (Dan Croak) +* All test helpers now in shoulda_macros. (Dan Croak) + +h2. 0.4.6 (2/11/2009) + +* Made the modules behave like mixins again. (hat-tip Eloy Duran) +* Created Actions and PrivateMethods modules on controllers for future RDoc reasons. (Dan Croak, Joe Ferris) + +h2. 0.4.5 (2/9/2009) + +* [#43] Removed email downcasing because local-part is case sensitive per RFC5321. (Dan Croak) +* [#42] Removed dependency on Mocha. (Dan Croak) +* Required Shoulda >= 2.9.1. (Dan Croak) +* Added password reset feature to clearance_features generator. (Eugene Bolshakov, Dan Croak) +* Removed unnecessary session[:salt]. (Dan Croak) +* [#41] Only store location for session[:return_to] for GET requests. (Dan Croak) +* Audited "sign up" naming convention. "Register" had slipped in a few places. (Dan Croak) +* Switched to SHA1 encryption. Cypher doesn't matter much for email confirmation, password reset. Better to have shorter hashes in the emails for clients who line break on 72 chars. (Dan Croak) + +h2. 0.4.4 (2/2/2009) + +* Added a generator for Cucumber features. (Joe Ferris, Dan Croak) +* Standarized naming for "Sign up," "Sign in," and "Sign out". (Dan Croak) diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/LICENSE b/vendor/gems/thoughtbot-clearance-0.8.2/LICENSE new file mode 100644 index 0000000..5060183 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2008 thoughtbot, inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/README.textile b/vendor/gems/thoughtbot-clearance-0.8.2/README.textile new file mode 100644 index 0000000..b5656e3 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/README.textile @@ -0,0 +1,123 @@ +h1. Clearance + +Rails authentication with email & password. + +"We have clearance, Clarence.":http://www.youtube.com/v/mNRXJEE3Nz8 + +h2. Suspenders + +Clearance is included in "Suspenders":http://github.com/thoughtbot/suspenders, which thoughtbot uses on all of our apps. We highly recommend you try it. Suspenders is the "King Gem" in our ecosystem, representating what we think the current state-of-the-art is in Rails development. + +h2. Installation + +Clearance is a Rails engine. It works with versions of Rails greater than 2.3. + +In config/environment.rb: + +
+config.gem "thoughtbot-clearance",
+  :lib     => 'clearance',
+  :source  => 'http://gems.github.com',
+  :version => '0.8.2'
+
+ +Vendor the gem: + +
+rake gems:install
+rake gems:unpack
+
+ +Make sure the development database exists and run the generator: + +
+script/generate clearance
+
+ +A number of files will be created and instructions will be printed. + +You may already have some of these files. Don't worry. You'll be asked if you want to overwrite them. + +Run the migration: + +
+rake db:migrate
+
+ +h2. If you aren't on Suspenders, you aren't done + +Define a HOST constant in your environment files. +In config/environments/test.rb and config/environments/development.rb it can be: + +
+HOST = "localhost"
+
+ +In production.rb it must be the actual host your application is deployed to. +The constant is used by mailers to generate URLs in emails. + +In config/environment.rb: + +
+DO_NOT_REPLY = "donotreply@example.com"
+
+ +Define root_url to *something* in your config/routes.rb: + +
+map.root :controller => 'home'
+
+ +h2. Cucumber Features + +As your app evolves, you want to know that authentication still works. thoughtbot's opinion is that you should test its integration with your app using "Cucumber":http://cukes.info/. + +Run the Cucumber generator (if you haven't already) and Clearance's feature generator: + +
+script/generate cucumber
+script/generate clearance_features
+
+ +All of the files generated should be new with the exception of the features/support/paths.rb file. If you have not modified your paths.rb then you will be okay to replace it with this one. If you need to keep your paths.rb file then add these locations in your paths.rb manually: + +
+def path_to(page_name)
+  case page_name
+   ...
+  when /the sign up page/i
+   new_user_path
+  when /the sign in page/i
+   new_session_path
+  when /the password reset request page/i
+   new_password_path
+  ...
+end
+
+ +h2. Formtastic views + +We have begun standardizing our forms using "Formtastic":http://github.com/justinfrench/formtastic. We highly recommend trying it. It will make your Rails view life more interesting. + +Clearance has another generator to generate Formastic views: + +
+script/generate clearance_views
+
+ +Its implementation is designed so that other view styles can be generated if the community wants it. However, we haven't needed them so you'll have to write the patch and send it back if you want other styles (such as Haml). + +h2. Authors + +Clearance was extracted out of "Hoptoad":http://hoptoadapp.com. We merged the authentication code from two of thoughtbot's clients' Rails apps and have since used it each time we need authentication. The following people have improved the library. Thank you! + +Dan Croak, Mike Burns, Jason Morrison, Joe Ferris, Eugene Bolshakov, Nick Quaranto, Josh Nichols, Mike Breen, Marcel Görner, Bence Nagy, Ben Mabey, Eloy Duran, Tim Pope, Mihai Anca, Mark Cornick, Shay Arnett, Joshua Clayton, Mustafa Ekim, & Jon Yurek. + +h2. Questions? + +Ask the "mailing list":http://groups.google.com/group/thoughtbot-clearance + +h2. Suggestions, Bugs, Refactoring? + +Fork away and create a "Github Issue":http://github.com/thoughtbot/clearance/issues. Please don't send pull requests. + diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/Rakefile b/vendor/gems/thoughtbot-clearance-0.8.2/Rakefile new file mode 100644 index 0000000..c28a442 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/Rakefile @@ -0,0 +1,103 @@ +# encoding: utf-8 + +require 'rake' +require 'rake/testtask' +require 'cucumber/rake/task' + +namespace :test do + Rake::TestTask.new(:basic => ["generator:cleanup", + "generator:clearance", + "generator:clearance_features"]) do |task| + task.libs << "lib" + task.libs << "test" + task.pattern = "test/**/*_test.rb" + task.verbose = false + end + + Rake::TestTask.new(:views => ["generator:clearance_views"]) do |task| + task.libs << "lib" + task.libs << "test" + task.pattern = "test/**/*_test.rb" + task.verbose = false + end + + Cucumber::Rake::Task.new(:features) do |t| + t.cucumber_opts = "--format progress" + t.feature_pattern = "test/rails_root/features/*.feature" + end + + Cucumber::Rake::Task.new(:features_for_views) do |t| + t.cucumber_opts = "--format progress" + t.feature_pattern = "test/rails_root/features/*.feature" + end +end + +generators = %w(clearance clearance_features clearance_views) + +namespace :generator do + desc "Cleans up the test app before running the generator" + task :cleanup do + generators.each do |generator| + FileList["generators/#{generator}/templates/**/*.*"].each do |each| + file = "test/rails_root/#{each.gsub("generators/#{generator}/templates/",'')}" + File.delete(file) if File.exists?(file) + end + end + + FileList["test/rails_root/db/**/*"].each do |each| + FileUtils.rm_rf(each) + end + + FileUtils.rm_rf("test/rails_root/vendor/plugins/clearance") + FileUtils.mkdir_p("test/rails_root/vendor/plugins") + clearance_root = File.expand_path(File.dirname(__FILE__)) + system("ln -s #{clearance_root} test/rails_root/vendor/plugins/clearance") + + FileUtils.rm_rf("test/rails_root/app/views/passwords") + FileUtils.rm_rf("test/rails_root/app/views/sessions") + FileUtils.rm_rf("test/rails_root/app/views/users") + end + + desc "Run the clearance generator" + task :clearance do + system "cd test/rails_root && ./script/generate clearance && rake db:migrate db:test:prepare" + end + + desc "Run the clearance features generator" + task :clearance_features do + system "cd test/rails_root && ./script/generate clearance_features" + end + + desc "Run the clearance views generator" + task :clearance_views do + system "cd test/rails_root && ./script/generate clearance_views" + end +end + +desc "Run the test suite" +task :default => ['test:basic', 'test:features', + 'test:views', 'test:features_for_views'] + +gem_spec = Gem::Specification.new do |gem_spec| + gem_spec.name = "clearance" + gem_spec.version = "0.8.2" + gem_spec.summary = "Rails authentication with email & password." + gem_spec.email = "support@thoughtbot.com" + gem_spec.homepage = "http://github.com/thoughtbot/clearance" + gem_spec.description = "Rails authentication with email & password." + gem_spec.authors = ["Dan Croak", "Mike Burns", "Jason Morrison", + "Joe Ferris", "Eugene Bolshakov", "Nick Quaranto", + "Josh Nichols", "Mike Breen", "Marcel Görner", + "Bence Nagy", "Ben Mabey", "Eloy Duran", + "Tim Pope", "Mihai Anca", "Mark Cornick", + "Shay Arnett", "Jon Yurek"] + gem_spec.files = FileList["[A-Z]*", "{app,config,generators,lib,shoulda_macros,rails}/**/*"] +end + +desc "Generate a gemspec file" +task :gemspec do + File.open("#{gem_spec.name}.gemspec", 'w') do |f| + f.write gem_spec.to_yaml + end +end + diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/TODO.textile b/vendor/gems/thoughtbot-clearance-0.8.2/TODO.textile new file mode 100644 index 0000000..9805aed --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/TODO.textile @@ -0,0 +1,6 @@ +h1. To-do + +* Make insertion of Clearance::User into User model automatic from the generator. +* Change generated README to include instruction about running the migration. +* DO_NOT_REPLY, HOST refactoring. + diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/app/controllers/clearance/confirmations_controller.rb b/vendor/gems/thoughtbot-clearance-0.8.2/app/controllers/clearance/confirmations_controller.rb new file mode 100644 index 0000000..d59b1e1 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/app/controllers/clearance/confirmations_controller.rb @@ -0,0 +1,75 @@ +class Clearance::ConfirmationsController < ApplicationController + unloadable + + before_filter :redirect_signed_in_confirmed_user, :only => [:new, :create] + before_filter :redirect_signed_out_confirmed_user, :only => [:new, :create] + before_filter :forbid_missing_token, :only => [:new, :create] + before_filter :forbid_non_existent_user, :only => [:new, :create] + + filter_parameter_logging :token + + def new + create + end + + def create + @user = ::User.find_by_id_and_confirmation_token( + params[:user_id], params[:token]) + @user.confirm_email! + + sign_in(@user) + flash_success_after_create + redirect_to(url_after_create) + end + + private + + def redirect_signed_in_confirmed_user + user = ::User.find_by_id(params[:user_id]) + if user && user.email_confirmed? && current_user == user + flash_success_after_create + redirect_to(url_after_create) + end + end + + def redirect_signed_out_confirmed_user + user = ::User.find_by_id(params[:user_id]) + if user && user.email_confirmed? && signed_out? + flash_already_confirmed + redirect_to(url_already_confirmed) + end + end + + def forbid_missing_token + if params[:token].blank? + raise ActionController::Forbidden, "missing token" + end + end + + def forbid_non_existent_user + unless ::User.find_by_id_and_confirmation_token( + params[:user_id], params[:token]) + raise ActionController::Forbidden, "non-existent user" + end + end + + def flash_success_after_create + flash[:success] = translate(:confirmed_email, + :scope => [:clearance, :controllers, :confirmations], + :default => "Confirmed email and signed in.") + end + + def flash_already_confirmed + flash[:success] = translate(:already_confirmed_email, + :scope => [:clearance, :controllers, :confirmations], + :default => "Already confirmed email. Please sign in.") + end + + def url_after_create + root_url + end + + def url_already_confirmed + sign_in_url + end +end diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/app/controllers/clearance/passwords_controller.rb b/vendor/gems/thoughtbot-clearance-0.8.2/app/controllers/clearance/passwords_controller.rb new file mode 100644 index 0000000..05a6f3d --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/app/controllers/clearance/passwords_controller.rb @@ -0,0 +1,84 @@ +class Clearance::PasswordsController < ApplicationController + unloadable + + before_filter :forbid_missing_token, :only => [:edit, :update] + before_filter :forbid_non_existent_user, :only => [:edit, :update] + filter_parameter_logging :password, :password_confirmation + + def new + render :template => 'passwords/new' + end + + def create + if user = ::User.find_by_email(params[:password][:email]) + user.forgot_password! + ::ClearanceMailer.deliver_change_password user + flash_notice_after_create + redirect_to(url_after_create) + else + flash_failure_after_create + render :template => 'passwords/new' + end + end + + def edit + @user = ::User.find_by_id_and_confirmation_token( + params[:user_id], params[:token]) + render :template => 'passwords/edit' + end + + def update + @user = ::User.find_by_id_and_confirmation_token( + params[:user_id], params[:token]) + + if @user.update_password(params[:user][:password], + params[:user][:password_confirmation]) + @user.confirm_email! + sign_in(@user) + flash_success_after_update + redirect_to(url_after_update) + else + render :template => 'passwords/edit' + end + end + + private + + def forbid_missing_token + if params[:token].blank? + raise ActionController::Forbidden, "missing token" + end + end + + def forbid_non_existent_user + unless ::User.find_by_id_and_confirmation_token( + params[:user_id], params[:token]) + raise ActionController::Forbidden, "non-existent user" + end + end + + def flash_notice_after_create + flash[:notice] = translate(:deliver_change_password, + :scope => [:clearance, :controllers, :passwords], + :default => "You will receive an email within the next few minutes. " << + "It contains instructions for changing your password.") + end + + def flash_failure_after_create + flash.now[:failure] = translate(:unknown_email, + :scope => [:clearance, :controllers, :passwords], + :default => "Unknown email.") + end + + def url_after_create + new_session_url + end + + def flash_success_after_update + flash[:success] = translate(:signed_in, :default => "Signed in.") + end + + def url_after_update + root_url + end +end diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/app/controllers/clearance/sessions_controller.rb b/vendor/gems/thoughtbot-clearance-0.8.2/app/controllers/clearance/sessions_controller.rb new file mode 100644 index 0000000..4505c92 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/app/controllers/clearance/sessions_controller.rb @@ -0,0 +1,66 @@ +class Clearance::SessionsController < ApplicationController + unloadable + + protect_from_forgery :except => :create + filter_parameter_logging :password + + def new + render :template => 'sessions/new' + end + + def create + @user = ::User.authenticate(params[:session][:email], + params[:session][:password]) + if @user.nil? + flash_failure_after_create + render :template => 'sessions/new', :status => :unauthorized + else + if @user.email_confirmed? + sign_in(@user) + flash_success_after_create + redirect_back_or(url_after_create) + else + ::ClearanceMailer.deliver_confirmation(@user) + flash_notice_after_create + redirect_to(new_session_url) + end + end + end + + def destroy + sign_out + flash_success_after_destroy + redirect_to(url_after_destroy) + end + + private + + def flash_failure_after_create + flash.now[:failure] = translate(:bad_email_or_password, + :scope => [:clearance, :controllers, :sessions], + :default => "Bad email or password.") + end + + def flash_success_after_create + flash[:success] = translate(:signed_in, :default => "Signed in.") + end + + def flash_notice_after_create + flash[:notice] = translate(:unconfirmed_email, + :scope => [:clearance, :controllers, :sessions], + :default => "User has not confirmed email. " << + "Confirmation email will be resent.") + end + + def url_after_create + root_url + end + + def flash_success_after_destroy + flash[:success] = translate(:signed_out, :default => "Signed out.") + end + + def url_after_destroy + new_session_url + end +end diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/app/controllers/clearance/users_controller.rb b/vendor/gems/thoughtbot-clearance-0.8.2/app/controllers/clearance/users_controller.rb new file mode 100644 index 0000000..6b8659e --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/app/controllers/clearance/users_controller.rb @@ -0,0 +1,35 @@ +class Clearance::UsersController < ApplicationController + unloadable + + before_filter :redirect_to_root, :only => [:new, :create], :if => :signed_in? + filter_parameter_logging :password + + def new + @user = ::User.new(params[:user]) + render :template => 'users/new' + end + + def create + @user = ::User.new params[:user] + if @user.save + ::ClearanceMailer.deliver_confirmation @user + flash_notice_after_create + redirect_to(url_after_create) + else + render :template => 'users/new' + end + end + + private + + def flash_notice_after_create + flash[:notice] = translate(:deliver_confirmation, + :scope => [:clearance, :controllers, :users], + :default => "You will receive an email within the next few minutes. " << + "It contains instructions for confirming your account.") + end + + def url_after_create + new_session_url + end +end diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/app/models/clearance_mailer.rb b/vendor/gems/thoughtbot-clearance-0.8.2/app/models/clearance_mailer.rb new file mode 100644 index 0000000..90f5f16 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/app/models/clearance_mailer.rb @@ -0,0 +1,23 @@ +class ClearanceMailer < ActionMailer::Base + + default_url_options[:host] = HOST + + def change_password(user) + from DO_NOT_REPLY + recipients user.email + subject I18n.t(:change_password, + :scope => [:clearance, :models, :clearance_mailer], + :default => "Change your password") + body :user => user + end + + def confirmation(user) + from DO_NOT_REPLY + recipients user.email + subject I18n.t(:confirmation, + :scope => [:clearance, :models, :clearance_mailer], + :default => "Account confirmation") + body :user => user + end + +end diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/app/views/clearance_mailer/change_password.html.erb b/vendor/gems/thoughtbot-clearance-0.8.2/app/views/clearance_mailer/change_password.html.erb new file mode 100644 index 0000000..603cd27 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/app/views/clearance_mailer/change_password.html.erb @@ -0,0 +1,9 @@ +Someone, hopefully you, has requested that we send you a link to change your password. + +Here's the link: + +<%= edit_user_password_url(@user, + :token => @user.confirmation_token, + :escape => false) %> + +If you didn't request this, ignore this email. Don't worry. Your password hasn't been changed. diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/app/views/clearance_mailer/confirmation.html.erb b/vendor/gems/thoughtbot-clearance-0.8.2/app/views/clearance_mailer/confirmation.html.erb new file mode 100644 index 0000000..260e45d --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/app/views/clearance_mailer/confirmation.html.erb @@ -0,0 +1,5 @@ + +<%= new_user_confirmation_url( + :user_id => @user, + :token => @user.confirmation_token, + :encode => false) %> diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/app/views/passwords/edit.html.erb b/vendor/gems/thoughtbot-clearance-0.8.2/app/views/passwords/edit.html.erb new file mode 100644 index 0000000..2cb817b --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/app/views/passwords/edit.html.erb @@ -0,0 +1,23 @@ +

Change your password

+ +

+ Your password has been reset. Choose a new password below. +

+ +<%= error_messages_for :user %> + +<% form_for(:user, + :url => user_password_path(@user, :token => @user.confirmation_token), + :html => { :method => :put }) do |form| %> +
+ <%= form.label :password, "Choose password" %> + <%= form.password_field :password %> +
+
+ <%= form.label :password_confirmation, "Confirm password" %> + <%= form.password_field :password_confirmation %> +
+
+ <%= form.submit "Save this password", :disable_with => "Please wait..." %> +
+<% end %> diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/app/views/passwords/new.html.erb b/vendor/gems/thoughtbot-clearance-0.8.2/app/views/passwords/new.html.erb new file mode 100644 index 0000000..bd37d6d --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/app/views/passwords/new.html.erb @@ -0,0 +1,15 @@ +

Change your password

+ +

+ We will email you a link to change your password. +

+ +<% form_for :password, :url => passwords_path do |form| %> +
+ <%= form.label :email, "Email address" %> + <%= form.text_field :email %> +
+
+ <%= form.submit "Reset password", :disable_with => "Please wait..." %> +
+<% end %> \ No newline at end of file diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/app/views/sessions/new.html.erb b/vendor/gems/thoughtbot-clearance-0.8.2/app/views/sessions/new.html.erb new file mode 100644 index 0000000..d229749 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/app/views/sessions/new.html.erb @@ -0,0 +1,24 @@ +

Sign in

+ +<% form_for :session, :url => session_path do |form| %> +
+ <%= form.label :email %> + <%= form.text_field :email %> +
+
+ <%= form.label :password %> + <%= form.password_field :password %> +
+
+ <%= form.submit "Sign in", :disable_with => "Please wait..." %> +
+<% end %> + + diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/app/views/users/_form.html.erb b/vendor/gems/thoughtbot-clearance-0.8.2/app/views/users/_form.html.erb new file mode 100644 index 0000000..6a9b8e0 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/app/views/users/_form.html.erb @@ -0,0 +1,13 @@ +<%= form.error_messages %> +
+ <%= form.label :email %> + <%= form.text_field :email %> +
+
+ <%= form.label :password %> + <%= form.password_field :password %> +
+
+ <%= form.label :password_confirmation, "Confirm password" %> + <%= form.password_field :password_confirmation %> +
\ No newline at end of file diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/app/views/users/new.html.erb b/vendor/gems/thoughtbot-clearance-0.8.2/app/views/users/new.html.erb new file mode 100644 index 0000000..de2ebf7 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/app/views/users/new.html.erb @@ -0,0 +1,6 @@ +

Sign up

+ +<% form_for @user do |form| %> + <%= render :partial => '/users/form', :object => form %> + <%= form.submit 'Sign up', :disable_with => 'Please wait...' %> +<% end %> diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/config/clearance_routes.rb b/vendor/gems/thoughtbot-clearance-0.8.2/config/clearance_routes.rb new file mode 100644 index 0000000..caeb5cc --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/config/clearance_routes.rb @@ -0,0 +1,30 @@ +ActionController::Routing::Routes.draw do |map| + map.resources :passwords, + :controller => 'clearance/passwords', + :only => [:new, :create] + + map.resource :session, + :controller => 'clearance/sessions', + :only => [:new, :create, :destroy] + + map.resources :users, :controller => 'clearance/users' do |users| + users.resource :password, + :controller => 'clearance/passwords', + :only => [:create, :edit, :update] + + users.resource :confirmation, + :controller => 'clearance/confirmations', + :only => [:new, :create] + end + + map.sign_up 'sign_up', + :controller => 'clearance/users', + :action => 'new' + map.sign_in 'sign_in', + :controller => 'clearance/sessions', + :action => 'new' + map.sign_out 'sign_out', + :controller => 'clearance/sessions', + :action => 'destroy', + :method => :delete +end diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/USAGE b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/USAGE new file mode 100644 index 0000000..3d9cabe --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/USAGE @@ -0,0 +1 @@ +script/generate clearance \ No newline at end of file diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/clearance_generator.rb b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/clearance_generator.rb new file mode 100644 index 0000000..d3704b7 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/clearance_generator.rb @@ -0,0 +1,41 @@ +require File.expand_path(File.dirname(__FILE__) + "/lib/insert_commands.rb") +require File.expand_path(File.dirname(__FILE__) + "/lib/rake_commands.rb") +require 'factory_girl' + +class ClearanceGenerator < Rails::Generator::Base + + def manifest + record do |m| + m.insert_into "app/controllers/application_controller.rb", + "include Clearance::Authentication" + + user_model = "app/models/user.rb" + if File.exists?(user_model) + m.insert_into user_model, "include Clearance::User" + else + m.directory File.join("app", "models") + m.file "user.rb", user_model + end + + m.directory File.join("test", "factories") + m.file "factories.rb", "test/factories/clearance.rb" + + m.migration_template "migrations/#{migration_name}.rb", + 'db/migrate', + :migration_file_name => "clearance_#{migration_name}" + + m.readme "README" + end + end + + private + + def migration_name + if ActiveRecord::Base.connection.table_exists?(:users) + 'update_users' + else + 'create_users' + end + end + +end diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/lib/insert_commands.rb b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/lib/insert_commands.rb new file mode 100644 index 0000000..cc76c56 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/lib/insert_commands.rb @@ -0,0 +1,33 @@ +# Mostly pinched from http://github.com/ryanb/nifty-generators/tree/master + +Rails::Generator::Commands::Base.class_eval do + def file_contains?(relative_destination, line) + File.read(destination_path(relative_destination)).include?(line) + end +end + +Rails::Generator::Commands::Create.class_eval do + def insert_into(file, line) + logger.insert "#{line} into #{file}" + unless options[:pretend] || file_contains?(file, line) + gsub_file file, /^(class|module) .+$/ do |match| + "#{match}\n #{line}" + end + end + end +end + +Rails::Generator::Commands::Destroy.class_eval do + def insert_into(file, line) + logger.remove "#{line} from #{file}" + unless options[:pretend] + gsub_file file, "\n #{line}", '' + end + end +end + +Rails::Generator::Commands::List.class_eval do + def insert_into(file, line) + logger.insert "#{line} into #{file}" + end +end diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/lib/rake_commands.rb b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/lib/rake_commands.rb new file mode 100644 index 0000000..a9fd417 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/lib/rake_commands.rb @@ -0,0 +1,22 @@ +Rails::Generator::Commands::Create.class_eval do + def rake_db_migrate + logger.rake "db:migrate" + unless system("rake db:migrate") + logger.rake "db:migrate failed. Rolling back" + command(:destroy).invoke! + end + end +end + +Rails::Generator::Commands::Destroy.class_eval do + def rake_db_migrate + logger.rake "db:rollback" + system "rake db:rollback" + end +end + +Rails::Generator::Commands::List.class_eval do + def rake_db_migrate + logger.rake "db:migrate" + end +end diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/templates/README b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/templates/README new file mode 100644 index 0000000..17850c8 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/templates/README @@ -0,0 +1,22 @@ + +******************************************************************************* + +Ok, enough fancy automatic stuff. Time for some old school monkey copy-pasting. + +1. Define a HOST constant in your environments files. +In config/environments/test.rb and config/environments/development.rb it can be: + + HOST = "localhost" + +In production.rb it must be the actual host your application is deployed to. +The constant is used by mailers to generate URLs in emails. + +2. In config/environment.rb: + + DO_NOT_REPLY = "donotreply@example.com" + +3. Define root_url to *something* in your config/routes.rb: + + map.root :controller => 'home' + +******************************************************************************* diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/templates/factories.rb b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/templates/factories.rb new file mode 100644 index 0000000..9bdd13a --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/templates/factories.rb @@ -0,0 +1,13 @@ +Factory.sequence :email do |n| + "user#{n}@example.com" +end + +Factory.define :user do |user| + user.email { Factory.next :email } + user.password { "password" } + user.password_confirmation { "password" } +end + +Factory.define :email_confirmed_user, :parent => :user do |user| + user.email_confirmed { true } +end diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/templates/migrations/create_users.rb b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/templates/migrations/create_users.rb new file mode 100644 index 0000000..4f7e62f --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/templates/migrations/create_users.rb @@ -0,0 +1,21 @@ +class ClearanceCreateUsers < ActiveRecord::Migration + def self.up + create_table(:users) do |t| + t.string :email + t.string :encrypted_password, :limit => 128 + t.string :salt, :limit => 128 + t.string :confirmation_token, :limit => 128 + t.string :remember_token, :limit => 128 + t.boolean :email_confirmed, :default => false, :null => false + t.timestamps + end + + add_index :users, [:id, :confirmation_token] + add_index :users, :email + add_index :users, :remember_token + end + + def self.down + drop_table :users + end +end diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/templates/migrations/update_users.rb b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/templates/migrations/update_users.rb new file mode 100644 index 0000000..cc352b2 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/templates/migrations/update_users.rb @@ -0,0 +1,41 @@ +class ClearanceUpdateUsers < ActiveRecord::Migration + def self.up +<% + existing_columns = ActiveRecord::Base.connection.columns(:users).collect { |each| each.name } + columns = [ + [:email, 't.string :email'], + [:encrypted_password, 't.string :encrypted_password, :limit => 128'], + [:salt, 't.string :salt, :limit => 128'], + [:confirmation_token, 't.string :confirmation_token, :limit => 128'], + [:remember_token, 't.string :remember_token, :limit => 128'], + [:email_confirmed, 't.boolean :email_confirmed, :default => false, :null => false'] + ].delete_if {|c| existing_columns.include?(c.first.to_s)} +-%> + change_table(:users) do |t| +<% columns.each do |c| -%> + <%= c.last %> +<% end -%> + end + +<% + existing_indexes = ActiveRecord::Base.connection.indexes(:users) + index_names = existing_indexes.collect { |each| each.name } + new_indexes = [ + [:index_users_on_id_and_confirmation_token, 'add_index :users, [:id, :confirmation_token]'], + [:index_users_on_email, 'add_index :users, :email'], + [:index_users_on_remember_token, 'add_index :users, :remember_token'] + ].delete_if { |each| index_names.include?(each.first.to_s) } +-%> +<% new_indexes.each do |each| -%> + <%= each.last %> +<% end -%> + end + + def self.down + change_table(:users) do |t| +<% unless columns.empty? -%> + t.remove <%= columns.collect { |each| ":#{each.first}" }.join(',') %> +<% end -%> + end + end +end diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/templates/user.rb b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/templates/user.rb new file mode 100644 index 0000000..6d077a1 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance/templates/user.rb @@ -0,0 +1,3 @@ +class User < ActiveRecord::Base + include Clearance::User +end diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/USAGE b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/USAGE new file mode 100644 index 0000000..3758c0b --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/USAGE @@ -0,0 +1 @@ +script/generate clearance_features diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/clearance_features_generator.rb b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/clearance_features_generator.rb new file mode 100644 index 0000000..48b57e4 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/clearance_features_generator.rb @@ -0,0 +1,20 @@ +class ClearanceFeaturesGenerator < Rails::Generator::Base + + def manifest + record do |m| + m.directory File.join("features", "step_definitions") + m.directory File.join("features", "support") + + ["features/step_definitions/clearance_steps.rb", + "features/step_definitions/factory_girl_steps.rb", + "features/support/paths.rb", + "features/sign_in.feature", + "features/sign_out.feature", + "features/sign_up.feature", + "features/password_reset.feature"].each do |file| + m.file file, file + end + end + end + +end diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/password_reset.feature b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/password_reset.feature new file mode 100644 index 0000000..51b77f7 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/password_reset.feature @@ -0,0 +1,33 @@ +Feature: Password reset + In order to sign in even if user forgot their password + A user + Should be able to reset it + + Scenario: User is not signed up + Given no user exists with an email of "email@person.com" + When I request password reset link to be sent to "email@person.com" + Then I should see "Unknown email" + + Scenario: User is signed up and requests password reset + Given I signed up with "email@person.com/password" + When I request password reset link to be sent to "email@person.com" + Then I should see "instructions for changing your password" + And a password reset message should be sent to "email@person.com" + + Scenario: User is signed up updated his password and types wrong confirmation + Given I signed up with "email@person.com/password" + When I follow the password reset link sent to "email@person.com" + And I update my password with "newpassword/wrongconfirmation" + Then I should see error messages + And I should be signed out + + Scenario: User is signed up and updates his password + Given I signed up with "email@person.com/password" + When I follow the password reset link sent to "email@person.com" + And I update my password with "newpassword/newpassword" + Then I should be signed in + When I sign out + Then I should be signed out + And I sign in as "email@person.com/newpassword" + Then I should be signed in + diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/sign_in.feature b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/sign_in.feature new file mode 100644 index 0000000..ab8dbf6 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/sign_in.feature @@ -0,0 +1,35 @@ +Feature: Sign in + In order to get access to protected sections of the site + A user + Should be able to sign in + + Scenario: User is not signed up + Given no user exists with an email of "email@person.com" + When I go to the sign in page + And I sign in as "email@person.com/password" + Then I should see "Bad email or password" + And I should be signed out + + Scenario: User is not confirmed + Given I signed up with "email@person.com/password" + When I go to the sign in page + And I sign in as "email@person.com/password" + Then I should see "User has not confirmed email" + And I should be signed out + + Scenario: User enters wrong password + Given I am signed up and confirmed as "email@person.com/password" + When I go to the sign in page + And I sign in as "email@person.com/wrongpassword" + Then I should see "Bad email or password" + And I should be signed out + + Scenario: User signs in successfully + Given I am signed up and confirmed as "email@person.com/password" + When I go to the sign in page + And I sign in as "email@person.com/password" + Then I should see "Signed in" + And I should be signed in + When I return next time + Then I should be signed in + diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/sign_out.feature b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/sign_out.feature new file mode 100644 index 0000000..8789d97 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/sign_out.feature @@ -0,0 +1,15 @@ +Feature: Sign out + To protect my account from unauthorized access + A signed in user + Should be able to sign out + + Scenario: User signs out + Given I am signed up and confirmed as "email@person.com/password" + When I sign in as "email@person.com/password" + Then I should be signed in + And I sign out + Then I should see "Signed out" + And I should be signed out + When I return next time + Then I should be signed out + diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/sign_up.feature b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/sign_up.feature new file mode 100644 index 0000000..4bb565d --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/sign_up.feature @@ -0,0 +1,45 @@ +Feature: Sign up + In order to get access to protected sections of the site + A user + Should be able to sign up + + Scenario: User signs up with invalid data + When I go to the sign up page + And I fill in "Email" with "invalidemail" + And I fill in "Password" with "password" + And I fill in "Confirm password" with "" + And I press "Sign Up" + Then I should see error messages + + Scenario: User signs up with valid data + When I go to the sign up page + And I fill in "Email" with "email@person.com" + And I fill in "Password" with "password" + And I fill in "Confirm password" with "password" + And I press "Sign Up" + Then I should see "instructions for confirming" + And a confirmation message should be sent to "email@person.com" + + Scenario: User confirms his account + Given I signed up with "email@person.com/password" + When I follow the confirmation link sent to "email@person.com" + Then I should see "Confirmed email and signed in" + And I should be signed in + + Scenario: Signed in user clicks confirmation link again + Given I signed up with "email@person.com/password" + When I follow the confirmation link sent to "email@person.com" + Then I should be signed in + When I follow the confirmation link sent to "email@person.com" + Then I should see "Confirmed email and signed in" + And I should be signed in + + Scenario: Signed out user clicks confirmation link again + Given I signed up with "email@person.com/password" + When I follow the confirmation link sent to "email@person.com" + Then I should be signed in + When I sign out + And I follow the confirmation link sent to "email@person.com" + Then I should see "Already confirmed email. Please sign in." + And I should be signed out + diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/step_definitions/clearance_steps.rb b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/step_definitions/clearance_steps.rb new file mode 100644 index 0000000..8da321a --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/step_definitions/clearance_steps.rb @@ -0,0 +1,116 @@ +# General + +Then /^I should see error messages$/ do + assert_match /error(s)? prohibited/m, response.body +end + +# Database + +Given /^no user exists with an email of "(.*)"$/ do |email| + assert_nil User.find_by_email(email) +end + +Given /^I signed up with "(.*)\/(.*)"$/ do |email, password| + user = Factory :user, + :email => email, + :password => password, + :password_confirmation => password +end + +Given /^I am signed up and confirmed as "(.*)\/(.*)"$/ do |email, password| + user = Factory :email_confirmed_user, + :email => email, + :password => password, + :password_confirmation => password +end + +# Session + +Then /^I should be signed in$/ do + assert controller.signed_in? +end + +Then /^I should be signed out$/ do + assert ! controller.signed_in? +end + +When /^session is cleared$/ do + request.reset_session + controller.instance_variable_set(:@_current_user, nil) +end + +Given /^I have signed in with "(.*)\/(.*)"$/ do |email, password| + Given %{I am signed up and confirmed as "#{email}/#{password}"} + And %{I sign in as "#{email}/#{password}"} +end + +# Emails + +Then /^a confirmation message should be sent to "(.*)"$/ do |email| + user = User.find_by_email(email) + sent = ActionMailer::Base.deliveries.first + assert_equal [user.email], sent.to + assert_match /confirm/i, sent.subject + assert !user.confirmation_token.blank? + assert_match /#{user.confirmation_token}/, sent.body +end + +When /^I follow the confirmation link sent to "(.*)"$/ do |email| + user = User.find_by_email(email) + visit new_user_confirmation_path(:user_id => user, + :token => user.confirmation_token) +end + +Then /^a password reset message should be sent to "(.*)"$/ do |email| + user = User.find_by_email(email) + sent = ActionMailer::Base.deliveries.first + assert_equal [user.email], sent.to + assert_match /password/i, sent.subject + assert !user.confirmation_token.blank? + assert_match /#{user.confirmation_token}/, sent.body +end + +When /^I follow the password reset link sent to "(.*)"$/ do |email| + user = User.find_by_email(email) + visit edit_user_password_path(:user_id => user, + :token => user.confirmation_token) +end + +When /^I try to change the password of "(.*)" without token$/ do |email| + user = User.find_by_email(email) + visit edit_user_password_path(:user_id => user) +end + +Then /^I should be forbidden$/ do + assert_response :forbidden +end + +# Actions + +When /^I sign in as "(.*)\/(.*)"$/ do |email, password| + When %{I go to the sign in page} + And %{I fill in "Email" with "#{email}"} + And %{I fill in "Password" with "#{password}"} + And %{I press "Sign In"} +end + +When /^I sign out$/ do + visit '/session', :delete +end + +When /^I request password reset link to be sent to "(.*)"$/ do |email| + When %{I go to the password reset request page} + And %{I fill in "Email address" with "#{email}"} + And %{I press "Reset password"} +end + +When /^I update my password with "(.*)\/(.*)"$/ do |password, confirmation| + And %{I fill in "Choose password" with "#{password}"} + And %{I fill in "Confirm password" with "#{confirmation}"} + And %{I press "Save this password"} +end + +When /^I return next time$/ do + When %{session is cleared} + And %{I go to the homepage} +end diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/step_definitions/factory_girl_steps.rb b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/step_definitions/factory_girl_steps.rb new file mode 100644 index 0000000..6337f66 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/step_definitions/factory_girl_steps.rb @@ -0,0 +1,5 @@ +Factory.factories.each do |name, factory| + Given /^an? #{name} exists with an? (.*) of "([^"]*)"$/ do |attr, value| + Factory(name, attr.gsub(' ', '_') => value) + end +end diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/support/paths.rb b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/support/paths.rb new file mode 100644 index 0000000..62ba3d5 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_features/templates/features/support/paths.rb @@ -0,0 +1,22 @@ +module NavigationHelpers + def path_to(page_name) + case page_name + + when /the homepage/i + root_path + when /the sign up page/i + new_user_path + when /the sign in page/i + new_session_path + when /the password reset request page/i + new_password_path + + # Add more page name => path mappings here + + else + raise "Can't find mapping from \"#{page_name}\" to a path." + end + end +end + +World(NavigationHelpers) diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/USAGE b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/USAGE new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/USAGE diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/clearance_views_generator.rb b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/clearance_views_generator.rb new file mode 100644 index 0000000..6075ed8 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/clearance_views_generator.rb @@ -0,0 +1,27 @@ +class ClearanceViewsGenerator < Rails::Generator::Base + + def manifest + record do |m| + strategy = "formtastic" + template_strategy = "erb" + + m.directory File.join("app", "views", "users") + m.file "#{strategy}/users/new.html.#{template_strategy}", + "app/views/users/new.html.#{template_strategy}" + m.file "#{strategy}/users/_inputs.html.#{template_strategy}", + "app/views/users/_inputs.html.#{template_strategy}" + + m.directory File.join("app", "views", "sessions") + m.file "#{strategy}/sessions/new.html.#{template_strategy}", + "app/views/sessions/new.html.#{template_strategy}" + + m.directory File.join("app", "views", "passwords") + m.file "#{strategy}/passwords/new.html.#{template_strategy}", + "app/views/passwords/new.html.#{template_strategy}" + m.file "#{strategy}/passwords/edit.html.#{template_strategy}", + "app/views/passwords/edit.html.#{template_strategy}" + end + end + +end + diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/templates/formtastic/passwords/edit.html.erb b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/templates/formtastic/passwords/edit.html.erb new file mode 100644 index 0000000..c206ca0 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/templates/formtastic/passwords/edit.html.erb @@ -0,0 +1,21 @@ +

Change your password

+ +

+ Your password has been reset. Choose a new password below. +

+ +<% semantic_form_for(:user, + :url => user_password_path(@user, :token => @user.confirmation_token), + :html => { :method => :put }) do |form| %> + <%= form.error_messages %> + <% form.inputs do -%> + <%= form.input :password, :as => :password, + :label => "Choose password" %> + <%= form.input :password_confirmation, :as => :password, + :label => "Confirm password" %> + <% end -%> + <% form.buttons do -%> + <%= form.commit_button "Save this password" %> + <% end -%> +<% end %> + diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/templates/formtastic/passwords/new.html.erb b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/templates/formtastic/passwords/new.html.erb new file mode 100644 index 0000000..4ac1269 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/templates/formtastic/passwords/new.html.erb @@ -0,0 +1,15 @@ +

Reset your password

+ +

+ We will email you a link to reset your password. +

+ +<% semantic_form_for :password, :url => passwords_path do |form| -%> + <% form.inputs do -%> + <%= form.input :email, :label => "Email address" %> + <% end -%> + <% form.buttons do -%> + <%= form.commit_button "Reset password" %> + <% end -%> +<% end -%> + diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/templates/formtastic/sessions/new.html.erb b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/templates/formtastic/sessions/new.html.erb new file mode 100644 index 0000000..388c179 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/templates/formtastic/sessions/new.html.erb @@ -0,0 +1,21 @@ +

Sign in

+ +<% semantic_form_for :session, :url => session_path do |form| %> + <% form.inputs do %> + <%= form.input :email %> + <%= form.input :password, :as => :password %> + <% end %> + <% form.buttons do %> + <%= form.commit_button "Sign in" %> + <% end %> +<% end %> + + + diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/templates/formtastic/users/_inputs.html.erb b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/templates/formtastic/users/_inputs.html.erb new file mode 100644 index 0000000..aff7908 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/templates/formtastic/users/_inputs.html.erb @@ -0,0 +1,6 @@ +<% form.inputs do %> + <%= form.input :email %> + <%= form.input :password %> + <%= form.input :password_confirmation, :label => "Confirm password" %> +<% end %> + diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/templates/formtastic/users/new.html.erb b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/templates/formtastic/users/new.html.erb new file mode 100644 index 0000000..be7f1dc --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/generators/clearance_views/templates/formtastic/users/new.html.erb @@ -0,0 +1,10 @@ +

Sign up

+ +<% semantic_form_for @user do |form| %> + <%= form.error_messages %> + <%= render :partial => "/users/inputs", :locals => { :form => form } %> + <% form.buttons do %> + <%= form.commit_button "Sign up" %> + <% end %> +<% end %> + diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance.rb b/vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance.rb new file mode 100644 index 0000000..260c4d6 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance.rb @@ -0,0 +1,6 @@ +require 'clearance/extensions/errors' +require 'clearance/extensions/rescue' +require 'clearance/extensions/routes' + +require 'clearance/authentication' +require 'clearance/user' diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance/authentication.rb b/vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance/authentication.rb new file mode 100644 index 0000000..065b325 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance/authentication.rb @@ -0,0 +1,125 @@ +module Clearance + module Authentication + + def self.included(controller) # :nodoc: + controller.send(:include, InstanceMethods) + + controller.class_eval do + helper_method :current_user, :signed_in?, :signed_out? + hide_action :current_user, :signed_in?, :signed_out? + end + end + + module InstanceMethods + # User in the current cookie + # + # @return [User, nil] + def current_user + @_current_user ||= user_from_cookie + end + + # Set the current user + # + # @param [User] + def current_user=(user) + @_current_user = user + end + + # Is the current user signed in? + # + # @return [true, false] + def signed_in? + ! current_user.nil? + end + + # Is the current user signed out? + # + # @return [true, false] + def signed_out? + current_user.nil? + end + + # Deny the user access if they are signed out. + # + # @example + # before_filter :authenticate + def authenticate + deny_access unless signed_in? + end + + # Sign user in to cookie. + # + # @param [User] + # + # @example + # sign_in(@user) + def sign_in(user) + if user + user.remember_me! + cookies[:remember_token] = { + :value => user.remember_token, + :expires => 1.year.from_now.utc + } + current_user = user + end + end + + # Sign user out of cookie. + # + # @example + # sign_out + def sign_out + cookies.delete(:remember_token) + current_user = nil + end + + # Store the current location. + # Display a flash message if included. + # Redirect to sign in. + # + # @param [String] optional flash message to display to denied user + def deny_access(flash_message = nil) + store_location + flash[:failure] = flash_message if flash_message + redirect_to(new_session_url) + end + + protected + + def user_from_cookie + if token = cookies[:remember_token] + ::User.find_by_remember_token(token) + end + end + + def sign_user_in(user) + warn "[DEPRECATION] sign_user_in: unnecessary. use sign_in(user) instead." + sign_in(user) + end + + def store_location + if request.get? + session[:return_to] = request.request_uri + end + end + + def redirect_back_or(default) + redirect_to(return_to || default) + clear_return_to + end + + def return_to + session[:return_to] || params[:return_to] + end + + def clear_return_to + session[:return_to] = nil + end + + def redirect_to_root + redirect_to(root_url) + end + end + + end +end diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance/extensions/errors.rb b/vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance/extensions/errors.rb new file mode 100644 index 0000000..d6b19bf --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance/extensions/errors.rb @@ -0,0 +1,6 @@ +if defined?(ActionController) + module ActionController + class Forbidden < StandardError + end + end +end diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance/extensions/rescue.rb b/vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance/extensions/rescue.rb new file mode 100644 index 0000000..7afe4ad --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance/extensions/rescue.rb @@ -0,0 +1,3 @@ +if defined?(ActionController::Base) + ActionController::Base.rescue_responses.update('ActionController::Forbidden' => :forbidden) +end diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance/extensions/routes.rb b/vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance/extensions/routes.rb new file mode 100644 index 0000000..1a6c43b --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance/extensions/routes.rb @@ -0,0 +1,14 @@ +if defined?(ActionController::Routing::RouteSet) + class ActionController::Routing::RouteSet + def load_routes_with_clearance! + lib_path = File.dirname(__FILE__) + clearance_routes = File.join(lib_path, *%w[.. .. .. config clearance_routes.rb]) + unless configuration_files.include?(clearance_routes) + add_configuration_file(clearance_routes) + end + load_routes_without_clearance! + end + + alias_method_chain :load_routes!, :clearance + end +end diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance/user.rb b/vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance/user.rb new file mode 100644 index 0000000..7bc8d22 --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/lib/clearance/user.rb @@ -0,0 +1,199 @@ +require 'digest/sha1' + +module Clearance + module User + + # Hook for all Clearance::User modules. + # + # If you need to override parts of Clearance::User, + # extend and include à la carte. + # + # @example + # extend ClassMethods + # include InstanceMethods + # include AttrAccessor + # include Callbacks + # + # @see ClassMethods + # @see InstanceMethods + # @see AttrAccessible + # @see AttrAccessor + # @see Validations + # @see Callbacks + def self.included(model) + model.extend(ClassMethods) + + model.send(:include, InstanceMethods) + model.send(:include, AttrAccessible) + model.send(:include, AttrAccessor) + model.send(:include, Validations) + model.send(:include, Callbacks) + end + + module AttrAccessible + # Hook for attr_accessible white list. + # + # :email, :password, :password_confirmation + # + # Append other attributes that must be mass-assigned in your model. + # + # @example + # include Clearance::User + # attr_accessible :location, :gender + def self.included(model) + model.class_eval do + attr_accessible :email, :password, :password_confirmation + end + end + end + + module AttrAccessor + # Hook for attr_accessor virtual attributes. + # + # :password, :password_confirmation + def self.included(model) + model.class_eval do + attr_accessor :password, :password_confirmation + end + end + end + + module Validations + # Hook for validations. + # + # :email must be present, unique, formatted + # + # If password is required, + # :password must be present, confirmed + def self.included(model) + model.class_eval do + validates_presence_of :email + validates_uniqueness_of :email, :case_sensitive => false + validates_format_of :email, :with => %r{.+@.+\..+} + + validates_presence_of :password, :if => :password_required? + validates_confirmation_of :password, :if => :password_required? + end + end + end + + module Callbacks + # Hook for callbacks. + # + # salt, token, password encryption are handled before_save. + def self.included(model) + model.class_eval do + before_save :initialize_salt, + :encrypt_password, + :initialize_confirmation_token + end + end + end + + module InstanceMethods + # Am I authenticated with given password? + # + # @param [String] plain-text password + # @return [true, false] + # @example + # user.authenticated?('password') + def authenticated?(password) + encrypted_password == encrypt(password) + end + + # Remember me for a year. + # + # @example + # user.remember_me! + # cookies[:remember_token] = { + # :value => user.remember_token, + # :expires => user.remember_token_expires_at + # } + def remember_me! + self.remember_token = encrypt("--#{Time.now.utc}--#{password}--") + save(false) + end + + # Confirm my email. + # + # @example + # user.confirm_email! + def confirm_email! + self.email_confirmed = true + self.confirmation_token = nil + save(false) + end + + # Mark my account as forgotten password. + # + # @example + # user.forgot_password! + def forgot_password! + generate_confirmation_token + save(false) + end + + # Update my password. + # + # @param [String, String] password and password confirmation + # @return [true, false] password was updated or not + # @example + # user.update_password('new-password', 'new-password') + def update_password(new_password, new_password_confirmation) + self.password = new_password + self.password_confirmation = new_password_confirmation + if valid? + self.confirmation_token = nil + end + save + end + + protected + + def generate_hash(string) + Digest::SHA1.hexdigest(string) + end + + def initialize_salt + if new_record? + self.salt = generate_hash("--#{Time.now.utc}--#{password}--") + end + end + + def encrypt_password + return if password.blank? + self.encrypted_password = encrypt(password) + end + + def encrypt(string) + generate_hash("--#{salt}--#{string}--") + end + + def generate_confirmation_token + self.confirmation_token = encrypt("--#{Time.now.utc}--#{password}--") + end + + def initialize_confirmation_token + generate_confirmation_token if new_record? + end + + def password_required? + encrypted_password.blank? || !password.blank? + end + end + + module ClassMethods + # Authenticate with email and password. + # + # @param [String, String] email and password + # @return [User, nil] authenticated user or nil + # @example + # User.authenticate("email@example.com", "password") + def authenticate(email, password) + return nil unless user = find_by_email(email) + return user if user.authenticated?(password) + end + end + + end +end diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/rails/init.rb b/vendor/gems/thoughtbot-clearance-0.8.2/rails/init.rb new file mode 100644 index 0000000..5ed1d1b --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/rails/init.rb @@ -0,0 +1 @@ +require 'clearance' \ No newline at end of file diff --git a/vendor/gems/thoughtbot-clearance-0.8.2/shoulda_macros/clearance.rb b/vendor/gems/thoughtbot-clearance-0.8.2/shoulda_macros/clearance.rb new file mode 100644 index 0000000..7d4729b --- /dev/null +++ b/vendor/gems/thoughtbot-clearance-0.8.2/shoulda_macros/clearance.rb @@ -0,0 +1,266 @@ +module Clearance + module Shoulda + + # STATE OF AUTHENTICATION + + def should_be_signed_in_as(&block) + warn "[DEPRECATION] should_be_signed_in_as cannot be used in functional tests anymore now that it depends on cookies, which are unavailable until the next request." + should "be signed in as #{block.bind(self).call}" do + user = block.bind(self).call + assert_not_nil user, + "please pass a User. try: should_be_signed_in_as { @user }" + assert_equal user, @controller.send(:current_user), + "#{user.inspect} is not the current_user, " << + "which is #{@controller.send(:current_user).inspect}" + end + end + + def should_be_signed_in_and_email_confirmed_as(&block) + warn "[DEPRECATION] should_be_signed_in_and_email_confirmed_as: questionable usefulness" + should_be_signed_in_as &block + + should "have confirmed email" do + user = block.bind(self).call + + assert_not_nil user + assert_equal user, assigns(:user) + assert assigns(:user).email_confirmed? + end + end + + def should_not_be_signed_in + warn "[DEPRECATION] should_not_be_signed_in is no longer a valid test since we now store a remember_token in cookies, not user_id in session" + should "not be signed in" do + assert_nil session[:user_id] + end + end + + def should_deny_access_on(http_method, action, opts = {}) + warn "[DEPRECATION] should_deny_access_on: use a setup & should_deny_access(:flash => ?)" + flash_message = opts.delete(:flash) + context "on #{http_method} to #{action}" do + setup do + send(http_method, action, opts) + end + + should_deny_access(:flash => flash_message) + end + end + + def should_deny_access(opts = {}) + if opts[:flash] + should_set_the_flash_to opts[:flash] + else + should_not_set_the_flash + end + + should_redirect_to('new_session_url') { new_session_url } + end + + # HTTP FLUENCY + + def should_forbid(description, &block) + should "forbid #{description}" do + assert_raises ActionController::Forbidden do + instance_eval(&block) + end + end + end + + # CONTEXTS + + def signed_in_user_context(&blk) + warn "[DEPRECATION] signed_in_user_context: creates a Mystery Guest, causes Obscure Test" + context "A signed in user" do + setup do + @user = Factory(:user) + @user.confirm_email! + sign_in_as @user + end + merge_block(&blk) + end + end + + def public_context(&blk) + warn "[DEPRECATION] public_context: common case is no-op. call sign_out otherwise" + context "The public" do + setup { sign_out } + merge_block(&blk) + end + end + + # CREATING USERS + + def should_create_user_successfully + warn "[DEPRECATION] should_create_user_successfully: not meant to be public, no longer used internally" + should_assign_to :user + should_change 'User.count', :by => 1 + + should "send the confirmation email" do + assert_sent_email do |email| + email.subject =~ /account confirmation/i + end + end + + should_set_the_flash_to /confirm/i + should_redirect_to_url_after_create + end + + # RENDERING + + def should_render_nothing + should "render nothing" do + assert @response.body.blank? + end + end + + # REDIRECTS + + def should_redirect_to_url_after_create + should_redirect_to("the post-create url") do + @controller.send(:url_after_create) + end + end + + def should_redirect_to_url_after_update + should_redirect_to("the post-update url") do + @controller.send(:url_after_update) + end + end + + def should_redirect_to_url_after_destroy + should_redirect_to("the post-destroy url") do + @controller.send(:url_after_destroy) + end + end + + def should_redirect_to_url_already_confirmed + should_redirect_to("the already confirmed url") do + @controller.send(:url_already_confirmed) + end + end + + # VALIDATIONS + + def should_validate_confirmation_of(attribute, opts = {}) + warn "[DEPRECATION] should_validate_confirmation_of: not meant to be public, no longer used internally" + raise ArgumentError if opts[:factory].nil? + + context "on save" do + should_validate_confirmation_is_not_blank opts[:factory], attribute + should_validate_confirmation_is_not_bad opts[:factory], attribute + end + end + + def should_validate_confirmation_is_not_blank(factory, attribute, opts = {}) + warn "[DEPRECATION] should_validate_confirmation_is_not_blank: not meant to be public, no longer used internally" + should "validate #{attribute}_confirmation is not blank" do + model = Factory.build(factory, blank_confirmation_options(attribute)) + model.save + assert_confirmation_error(model, attribute, + "#{attribute}_confirmation cannot be blank") + end + end + + def should_validate_confirmation_is_not_bad(factory, attribute, opts = {}) + warn "[DEPRECATION] should_validate_confirmation_is_not_bad: not meant to be public, no longer used internally" + should "validate #{attribute}_confirmation is different than #{attribute}" do + model = Factory.build(factory, bad_confirmation_options(attribute)) + model.save + assert_confirmation_error(model, attribute, + "#{attribute}_confirmation cannot be different than #{attribute}") + end + end + + # FORMS + + def should_display_a_password_update_form + warn "[DEPRECATION] should_display_a_password_update_form: not meant to be public, no longer used internally" + should "have a form for the user's token, password, and password confirm" do + update_path = ERB::Util.h( + user_password_path(@user, :token => @user.confirmation_token) + ) + + assert_select 'form[action=?]', update_path do + assert_select 'input[name=_method][value=?]', 'put' + assert_select 'input[name=?]', 'user[password]' + assert_select 'input[name=?]', 'user[password_confirmation]' + end + end + end + + def should_display_a_sign_up_form + warn "[DEPRECATION] should_display_a_sign_up_form: not meant to be public, no longer used internally" + should "display a form to sign up" do + assert_select "form[action=#{users_path}][method=post]", + true, "There must be a form to sign up" do + assert_select "input[type=text][name=?]", + "user[email]", true, "There must be an email field" + assert_select "input[type=password][name=?]", + "user[password]", true, "There must be a password field" + assert_select "input[type=password][name=?]", + "user[password_confirmation]", true, "There must be a password confirmation field" + assert_select "input[type=submit]", true, + "There must be a submit button" + end + end + end + + def should_display_a_sign_in_form + warn "[DEPRECATION] should_display_a_sign_in_form: not meant to be public, no longer used internally" + should 'display a "sign in" form' do + assert_select "form[action=#{session_path}][method=post]", + true, "There must be a form to sign in" do + assert_select "input[type=text][name=?]", + "session[email]", true, "There must be an email field" + assert_select "input[type=password][name=?]", + "session[password]", true, "There must be a password field" + assert_select "input[type=submit]", true, + "There must be a submit button" + end + end + end + end +end + +module Clearance + module Shoulda + module Helpers + def sign_in_as(user) + @controller.current_user = user + return user + end + + def sign_in + sign_in_as Factory(:email_confirmed_user) + end + + def sign_out + @controller.current_user = nil + end + + def blank_confirmation_options(attribute) + warn "[DEPRECATION] blank_confirmation_options: not meant to be public, no longer used internally" + opts = { attribute => attribute.to_s } + opts.merge("#{attribute}_confirmation".to_sym => "") + end + + def bad_confirmation_options(attribute) + warn "[DEPRECATION] bad_confirmation_options: not meant to be public, no longer used internally" + opts = { attribute => attribute.to_s } + opts.merge("#{attribute}_confirmation".to_sym => "not_#{attribute}") + end + + def assert_confirmation_error(model, attribute, message = "confirmation error") + warn "[DEPRECATION] assert_confirmation_error: not meant to be public, no longer used internally" + assert model.errors.on(attribute).include?("doesn't match confirmation"), + message + end + end + end +end + +class Test::Unit::TestCase + include Clearance::Shoulda::Helpers +end +Test::Unit::TestCase.extend(Clearance::Shoulda) -- libgit2 0.21.2