From: Tom Hughes Date: Mon, 3 May 2010 16:09:37 +0000 (+0100) Subject: Tell users their account has been suspended when they try and login X-Git-Tag: live~6338^2~14 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/5d3992daca978f714ff9d6758b6155b9f08ee3f5 Tell users their account has been suspended when they try and login --- diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index f24e1ee72..af0ccba05 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -173,8 +173,10 @@ class UserController < ApplicationController else redirect_to :controller => 'site', :action => 'index' end - elsif User.authenticate(:username => email_or_display_name, :password => pass, :inactive => true) + elsif User.authenticate(:username => email_or_display_name, :password => pass, :pending => true) flash.now[:error] = t 'user.login.account not active' + elsif User.authenticate(:username => email_or_display_name, :password => pass, :suspended => true) + flash.now[:error] = t 'user.login.account suspended' else flash.now[:error] = t 'user.login.auth failure' end diff --git a/app/models/user.rb b/app/models/user.rb index 23e95bc88..31b0f27a0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -56,8 +56,11 @@ class User < ActiveRecord::Base user = token.user if token end - if user - user = nil unless user.visible? and (user.active? or options[:inactive]) + if user and + ( user.status == "deleted" or + ( user.status == "pending" and not options[:pending] ) or + ( user.status == "suspended" and not options[:suspended] ) ) + user = nil end token.update_attribute(:expiry, 1.week.from_now) if token and user diff --git a/config/locales/en.yml b/config/locales/en.yml index 3c5073e21..21e5795cb 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1489,6 +1489,7 @@ en: lost password link: "Lost your password?" login_button: "Login" account not active: "Sorry, your account is not active yet.
Please click on the link in the account confirmation email to activate your account." + account suspended: Sorry, your account has been suspended due to suspicious activity.
Please contact the webmaster if you wish to discuss this. auth failure: "Sorry, could not log in with those details." logout: title: "Logout"