mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:34:31 +08:00
FIX: suspended users are logged out when they are suspended. Show a reason for suspension when they try to log in.
This commit is contained in:
@ -19,12 +19,20 @@ class Auth::Result
|
||||
if requires_invite
|
||||
{ requires_invite: true }
|
||||
elsif user
|
||||
{
|
||||
authenticated: !!authenticated,
|
||||
awaiting_activation: !!awaiting_activation,
|
||||
awaiting_approval: !!awaiting_approval,
|
||||
not_allowed_from_ip_address: !!not_allowed_from_ip_address
|
||||
}
|
||||
if user.suspended?
|
||||
{
|
||||
suspended: true,
|
||||
suspended_message: I18n.t( user.suspend_reason ? "login.suspended_with_reason" : "login.suspended",
|
||||
{date: I18n.l(user.suspended_till, format: :date_only), reason: user.suspend_reason} )
|
||||
}
|
||||
else
|
||||
{
|
||||
authenticated: !!authenticated,
|
||||
awaiting_activation: !!awaiting_activation,
|
||||
awaiting_approval: !!awaiting_approval,
|
||||
not_allowed_from_ip_address: !!not_allowed_from_ip_address
|
||||
}
|
||||
end
|
||||
else
|
||||
{
|
||||
email: email,
|
||||
|
Reference in New Issue
Block a user