mirror of
https://github.com/discourse/discourse.git
synced 2025-09-07 12:02:53 +08:00
When banning a user, a reason can be provided. The user will see this reason when trying to log in. Also log bans and unbans in the staff action logs.
This commit is contained in:
parent
52b0c1c45f
commit
92a0729937
17 changed files with 180 additions and 26 deletions
|
@ -28,7 +28,11 @@ class SessionController < ApplicationController
|
|||
if @user.confirm_password?(password)
|
||||
|
||||
if @user.is_banned?
|
||||
render json: { error: I18n.t("login.banned", {date: I18n.l(@user.banned_till, format: :date_only)}) }
|
||||
if reason = @user.ban_reason
|
||||
render json: { error: I18n.t("login.banned_with_reason", {date: I18n.l(@user.banned_till, format: :date_only), reason: reason}) }
|
||||
else
|
||||
render json: { error: I18n.t("login.banned", {date: I18n.l(@user.banned_till, format: :date_only)}) }
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue