Logging into a site without membership now correctly displays an error message and redirects to login.

This commit is contained in:
Mario Visic 2011-02-20 21:39:02 +08:00
parent 2244aa782a
commit f5b4e30d0a
2 changed files with 6 additions and 2 deletions

View File

@ -12,6 +12,7 @@ en:
unconfirmed: 'You have to confirm your account before continuing.'
locked: 'Your account is locked.'
invalid: 'Invalid email or password.'
no_membership: 'Your account is not a member of this site, please contact the site administrator to gain access.'
invalid_token: 'Invalid authentication token.'
timeout: 'Your session expired, please sign in again to continue.'
inactive: 'Your account was not activated yet.'

View File

@ -38,8 +38,11 @@ module Locomotive
end
def validate_site_membership
return if current_site && current_site.accounts.include?(current_admin)
sign_out_and_redirect(current_admin)
unless current_site.present? && current_site.accounts.include?(current_admin)
sign_out(current_admin)
flash[:alert] = I18n.t(:no_membership, :scope => [:devise, :failure, :admin])
redirect_to new_admin_session_url
end
end
end