diff --git a/Gemfile b/Gemfile index e31f004..7e53c45 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ gem 'rails', '3.2.0' # gem 'pg' gem 'mysql2' -gem 'devise', '~> 1.5.3' +gem 'devise', '~> 2.0.4' gem 'cancan', '~> 1.6.7' gem 'squeel', '~> 0.9.3' gem 'sentient_user', '~> 0.3.2' diff --git a/Gemfile.lock b/Gemfile.lock index 6a9233d..49df7eb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,7 +6,7 @@ GIT GIT remote: https://github.com/activescaffold/active_scaffold.git - revision: 987fdf05f4e5bf3e2e749e8de7bcc467c9c6c642 + revision: ab2dae8cc7da5957720bf911d0a66785056fc70e specs: active_scaffold (3.2.0) rails (>= 3.1.3) @@ -44,7 +44,7 @@ GEM activesupport (3.2.0) i18n (~> 0.6) multi_json (~> 1.0) - arel (3.0.0) + arel (3.0.2) bcrypt-ruby (3.0.1) bootstrap-sass-rails (2.0.0.3) rails (~> 3.1) @@ -85,10 +85,11 @@ GEM daemons (1.0.10) dalli (1.1.4) database_cleaner (0.7.1) - devise (1.5.3) + devise (2.0.4) bcrypt-ruby (~> 3.0) orm_adapter (~> 0.0.3) - warden (~> 1.1) + railties (~> 3.1) + warden (~> 1.1.1) diff-lcs (1.1.3) erubis (2.7.0) execjs (1.3.0) @@ -114,7 +115,7 @@ GEM highline (1.6.11) hike (1.2.1) i18n (0.6.0) - journey (1.0.1) + journey (1.0.3) jquery-rails (2.0.0) railties (>= 3.2.0.beta, < 5.0) thor (~> 0.14) @@ -204,9 +205,10 @@ GEM json_pure rubyzip sentient_user (0.3.2) - simplecov (0.4.2) - simplecov-html (~> 0.4.4) - simplecov-html (0.4.5) + simplecov (0.6.0) + multi_json (~> 1.0) + simplecov-html (~> 0.5.3) + simplecov-html (0.5.3) spork (1.0.0rc2) sprockets (2.1.2) hike (~> 1.2) @@ -250,7 +252,7 @@ DEPENDENCIES compass-rails (~> 1.0.0.rc.2) dalli (~> 1.1.3) database_cleaner (~> 0.7.1) - devise (~> 1.5.3) + devise (~> 2.0.4) factory_girl_rails (~> 1.6.0) faker (~> 1.0.1) guard-rspec (~> 0.6.0) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 507b51e..a12118d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,3 +1,5 @@ +# encoding: UTF-8 + module ApplicationHelper FLASH_ALIASES = HashWithIndifferentAccess.new( diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 46e166e..3c61268 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -5,7 +5,7 @@ - EntryDNS + <%= content_for?(:title) ? yield(:title) : "EntryDNS" %> <%= stylesheet_link_tag "application" %> <%= javascript_include_tag "application" %> diff --git a/app/views/layouts/errors.html.erb b/app/views/layouts/errors.html.erb index 92b183d..91db50e 100644 --- a/app/views/layouts/errors.html.erb +++ b/app/views/layouts/errors.html.erb @@ -5,7 +5,7 @@ - EntryDNS + <%= content_for?(:title) ? yield(:title) : "EntryDNS" %> <%= stylesheet_link_tag "application" %> <%= javascript_include_tag "application" %> diff --git a/app/views/layouts/public.html.erb b/app/views/layouts/public.html.erb index 8e95344..f0cfccf 100644 --- a/app/views/layouts/public.html.erb +++ b/app/views/layouts/public.html.erb @@ -5,10 +5,10 @@ - EntryDNS free DNS service and dynamic DNS + <%= content_for?(:title) ? yield(:title) : "EntryDNS free DNS service and dynamic DNS" %> - - + " /> + " /> <%= stylesheet_link_tag "application" %> diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index c3d463e..a5f261a 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -74,11 +74,11 @@ Devise.setup do |config| # ==> Configuration for :confirmable # The time you want to give your user to confirm his account. During this time # he will be able to access your application without confirming. Default is 0.days - # When confirm_within is zero, the user won't be able to sign in without confirming. + # When allow_unconfirmed_access_for is zero, the user won't be able to sign in without confirming. # You can use this to let your user access some features of your application # without confirming the account, but blocking it after a certain period # (ie 2 days). - # config.confirm_within = 2.days + # config.allow_unconfirmed_access_for = 2.days # Defines which key will be used when confirming an account # config.confirmation_keys = [ :email ] @@ -87,9 +87,6 @@ Devise.setup do |config| # The time the user will be remembered without asking for credentials again. # config.remember_for = 2.weeks - # If true, a valid remember token can be re-used between multiple browsers. - # config.remember_across_browsers = true - # If true, extends the user's remember period when remembered via cookie. # config.extend_remember_period = false @@ -160,10 +157,6 @@ Devise.setup do |config| # Defines name of the authentication token params key # config.token_authentication_key = :auth_token - # If true, authentication through token does not store user in session and needs - # to be supplied on each request. Useful if you are using the token as API token. - # config.stateless_token = false - # ==> Scopes configuration # Turn scoped views on. Before rendering "sessions/new", it will first check for # "users/sessions/new". It's turned off by default because it's slower if you diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml index 404e976..fa1cc5f 100644 --- a/config/locales/devise.en.yml +++ b/config/locales/devise.en.yml @@ -35,14 +35,9 @@ en: send_paranoid_instructions: 'If your e-mail exists on our database, you will receive an email with instructions about how to confirm your account in a few minutes.' confirmed: 'Your account was successfully confirmed. You are now signed in.' registrations: - signed_up: 'Welcome! You have signed up successfully.' - inactive_signed_up: 'You have signed up successfully. However, we could not sign you in because your account is %{reason}.' - updated: 'You updated your account successfully.' - destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.' - reasons: - inactive: 'inactive' - unconfirmed: 'unconfirmed' - locked: 'locked' + signed_up_but_unconfirmed: 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.' + signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.' + signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.' unlocks: send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.' unlocked: 'Your account was successfully unlocked. You are now signed in.' diff --git a/db/migrate/20110917082609_devise_create_users.rb b/db/migrate/20110917082609_devise_create_users.rb index 533a693..bc9bd21 100644 --- a/db/migrate/20110917082609_devise_create_users.rb +++ b/db/migrate/20110917082609_devise_create_users.rb @@ -1,16 +1,45 @@ class DeviseCreateUsers < ActiveRecord::Migration def self.up create_table(:users) do |t| - t.database_authenticatable :null => false - t.recoverable - t.rememberable - t.trackable - t.confirmable - t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both - - # t.encryptable - # t.token_authenticatable - + + ## Database authenticatable + t.string :email, :null => false, :default => "" + t.string :encrypted_password, :null => false, :default => "" + + ## Recoverable + t.string :reset_password_token + t.datetime :reset_password_sent_at + + ## Rememberable + t.datetime :remember_created_at + + ## Trackable + t.integer :sign_in_count, :default => 0 + t.datetime :current_sign_in_at + t.datetime :last_sign_in_at + t.string :current_sign_in_ip + t.string :last_sign_in_ip + + ## Confirmable + t.string :confirmation_token + t.datetime :confirmed_at + t.datetime :confirmation_sent_at + t.string :unconfirmed_email # Only if using reconfirmable + + ## Lockable + t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts + t.string :unlock_token # Only if unlock strategy is :email or :both + t.datetime :locked_at + + ## Encryptable + # t.string :password_salt + + # Token authenticatable + # t.string :authentication_token + + ## Invitable + # t.string :invitation_token + t.timestamps end diff --git a/db/samples.rb b/db/samples.rb index 8f3d3c5..af1fc75 100644 --- a/db/samples.rb +++ b/db/samples.rb @@ -1,6 +1,8 @@ -require 'factory_girl' -require 'faker' -require Rails.root.join('spec', 'factories.rb') +unless Object.const_defined?('FactoryGirl') + require 'factory_girl' + require 'faker' + require Rails.root.join('spec', 'factories.rb') +end # more sample users users = [User.find_by_email('user@entrydns.net')] @@ -31,4 +33,4 @@ for user in users 50.times do Factory.create(:a, :user => user, :domain => entrydns_org) end -end \ No newline at end of file +end