diff --git a/app/assets/stylesheets/pages/home.css.scss b/app/assets/stylesheets/pages/home.css.scss index d465cfc..551bf6c 100644 --- a/app/assets/stylesheets/pages/home.css.scss +++ b/app/assets/stylesheets/pages/home.css.scss @@ -15,8 +15,7 @@ } .page-home-header { - @include background(image-url("page-home-incentives.png"), - radial-gradient(color-stops(#fff, #c1f1ff), bottom)); + @include background(radial-gradient(color-stops(#fff, #c1f1ff), bottom)); border-bottom: 1px solid #B9DCFF; .page-header { small { @@ -68,4 +67,8 @@ padding-right: 20px; } } +} + +.public .alert { + margin-bottom: 0; } \ No newline at end of file diff --git a/app/models/admin.rb b/app/models/admin.rb index 3106a9f..d68ba40 100644 --- a/app/models/admin.rb +++ b/app/models/admin.rb @@ -8,4 +8,15 @@ class Admin < ActiveRecord::Base # Setup accessible (or protected) attributes for your model attr_accessible :email, :password, :password_confirmation, :remember_me # attr_accessible :title, :body + + # Called by Devise to see if an user can currently be signed in + def active_for_authentication? + active? && super + end + + # Called by Devise to get the proper error message when an user cannot be signed in + def inactive_message + !active? ? :deactivated : super + end + end diff --git a/app/models/user.rb b/app/models/user.rb index a1dd2ea..77500e3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -37,6 +37,16 @@ class User < ActiveRecord::Base domains.count >= Settings.max_domains_per_user.to_i end + # Called by Devise to see if an user can currently be signed in + def active_for_authentication? + active? && super + end + + # Called by Devise to get the proper error message when an user cannot be signed in + def inactive_message + !active? ? :deactivated : super + end + delegate :can?, :cannot?, :to => :ability def ability(options = {:reload => false}) diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml index fa1cc5f..64eaab3 100644 --- a/config/locales/devise.en.yml +++ b/config/locales/devise.en.yml @@ -21,6 +21,7 @@ en: invalid_token: 'Invalid authentication token.' timeout: 'Your session expired, please sign in again to continue.' inactive: 'Your account was not activated yet.' + deactivated: 'Account locked.' sessions: # signed_in: 'Signed in successfully.' signed_in: '' @@ -38,6 +39,7 @@ en: 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.' + signed_up_but_deactivated: 'You have signed up successfully. However, we could not sign you in because your account is deactivated.' 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/20130305074635_add_active_to_admins_and_users.rb b/db/migrate/20130305074635_add_active_to_admins_and_users.rb new file mode 100644 index 0000000..06272bc --- /dev/null +++ b/db/migrate/20130305074635_add_active_to_admins_and_users.rb @@ -0,0 +1,9 @@ +class AddActiveToAdminsAndUsers < ActiveRecord::Migration + def change + add_column :admins, :active, :boolean, default: false + admin = Admin.where(email: 'admin@entrydns.net').first + admin.update_attribute(active, true) if admin + + add_column :users, :active, :boolean, default: true + end +end