]> git.openstreetmap.org Git - rails.git/commitdiff
Tell users their account has been suspended when they try and login
authorTom Hughes <tom@compton.nu>
Mon, 3 May 2010 16:09:37 +0000 (17:09 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 6 May 2010 16:18:34 +0000 (17:18 +0100)
app/controllers/user_controller.rb
app/models/user.rb
config/locales/en.yml

index f24e1ee72c5c96f30d3fd1fad8d9952384b76cd6..af0ccba055eef8824a59b0441f5f3e5603ca4a33 100644 (file)
@@ -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
index 23e95bc8803e3a1469ce58cefdd57a1990746069..31b0f27a03428ef9223b3c00bfe05bd89504c27f 100644 (file)
@@ -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
index 3c5073e21f1c9d980706ed68a0ea6a4be3811f9f..21e5795cb8f5f90a0aea5af89370436403e9af13 100644 (file)
@@ -1489,6 +1489,7 @@ en:
       lost password link: "Lost your password?"
       login_button: "Login"
       account not active: "Sorry, your account is not active yet.<br />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.<br />Please contact the <a href="mailto:webmaster@openstreetmap.org">webmaster</a> if you wish to discuss this.
       auth failure: "Sorry, could not log in with those details."
     logout:
       title: "Logout"