Fix exception when a suspended user tries to login

This commit is contained in:
Tom Hughes 2012-01-23 14:31:06 +00:00
parent c6b295ab2d
commit 2c666b42d7
2 changed files with 3 additions and 6 deletions

View file

@ -512,8 +512,7 @@ private
elsif user = User.authenticate(:username => username, :password => password, :pending => true) elsif user = User.authenticate(:username => username, :password => password, :pending => true)
failed_login t('user.login.account not active', :reconfirm => url_for(:action => 'confirm_resend', :display_name => user.display_name)) failed_login t('user.login.account not active', :reconfirm => url_for(:action => 'confirm_resend', :display_name => user.display_name))
elsif User.authenticate(:username => username, :password => password, :suspended => true) elsif User.authenticate(:username => username, :password => password, :suspended => true)
webmaster = link_to t('user.login.webmaster'), "mailto:webmaster@openstreetmap.org" failed_login t('user.login.account is suspended', :webmaster => "mailto:webmaster@openstreetmap.org")
failed_login t('user.login.account suspended', :webmaster => webmaster)
else else
failed_login t('user.login.auth failure') failed_login t('user.login.auth failure')
end end
@ -546,8 +545,7 @@ private
when "active", "confirmed" then when "active", "confirmed" then
successful_login(user) successful_login(user)
when "suspended" then when "suspended" then
webmaster = link_to t('user.login.webmaster'), "mailto:webmaster@openstreetmap.org" failed_login t('user.login.account is suspended', :webmaster => "mailto:webmaster@openstreetmap.org")
failed_login t('user.login.account suspended', :webmaster => webmaster)
else else
failed_login t('user.login.auth failure') failed_login t('user.login.auth failure')
end end

View file

@ -1552,8 +1552,7 @@ en:
to make changes: To make changes to the OpenStreetMap data, you must have an account. to make changes: To make changes to the OpenStreetMap data, you must have an account.
create account minute: Create an account. It only takes a minute. create account minute: Create an account. It only takes a minute.
account not active: "Sorry, your account is not active yet.<br />Please use the link in the account confirmation email to activate your account, or <a href=\"%{reconfirm}\">request a new confirmation email</a>." account not active: "Sorry, your account is not active yet.<br />Please use the link in the account confirmation email to activate your account, or <a href=\"%{reconfirm}\">request a new confirmation email</a>."
account suspended: Sorry, your account has been suspended due to suspicious activity.<br />Please contact the %{webmaster} if you wish to discuss this. account is suspended: Sorry, your account has been suspended due to suspicious activity.<br />Please contact the <a href="%{webmaster}">webmaster</a> if you wish to discuss this.
webmaster: webmaster
auth failure: "Sorry, could not log in with those details." auth failure: "Sorry, could not log in with those details."
notice: "<a href=\"http://www.osmfoundation.org/wiki/License/We_Are_Changing_The_License\">Find out more about OpenStreetMap's upcoming license change</a> (<a href=\"http://wiki.openstreetmap.org/wiki/ODbL/We_Are_Changing_The_License\">translations</a>) (<a href=\"http://wiki.openstreetmap.org/wiki/Talk:ODbL/Upcoming\">discussion</a>)" notice: "<a href=\"http://www.osmfoundation.org/wiki/License/We_Are_Changing_The_License\">Find out more about OpenStreetMap's upcoming license change</a> (<a href=\"http://wiki.openstreetmap.org/wiki/ODbL/We_Are_Changing_The_License\">translations</a>) (<a href=\"http://wiki.openstreetmap.org/wiki/Talk:ODbL/Upcoming\">discussion</a>)"
notice_terms: "OpenStreetMap is moving to a new licence on 1st April 2012. It's just as open as our current one, but the legal bits are much better suited to our map database. We'd love to keep your contributions in OpenStreetMap, but we can only do so if you agree to let us distribute them under the new licence. Otherwise, we'll have to remove them from the database.<br /><br />Please log in, then take a few seconds to review and accept the new terms. Thank you!" notice_terms: "OpenStreetMap is moving to a new licence on 1st April 2012. It's just as open as our current one, but the legal bits are much better suited to our map database. We'd love to keep your contributions in OpenStreetMap, but we can only do so if you agree to let us distribute them under the new licence. Otherwise, we'll have to remove them from the database.<br /><br />Please log in, then take a few seconds to review and accept the new terms. Thank you!"