diff --git a/app/assets/javascripts/discourse/controllers/login.js.es6 b/app/assets/javascripts/discourse/controllers/login.js.es6 index b2eed5cee..cd81f119c 100644 --- a/app/assets/javascripts/discourse/controllers/login.js.es6 +++ b/app/assets/javascripts/discourse/controllers/login.js.es6 @@ -69,6 +69,9 @@ export default Ember.Controller.extend(ModalFunctionality, { sentTo: result.sent_to_email, currentEmail: result.current_email }); + } else if (result.reason === 'suspended' ) { + self.send("closeModal"); + bootbox.alert(result.error); } else { self.flash(result.error, 'error'); } diff --git a/app/controllers/session_controller.rb b/app/controllers/session_controller.rb index bcf9db0ee..a34b31b70 100644 --- a/app/controllers/session_controller.rb +++ b/app/controllers/session_controller.rb @@ -261,8 +261,10 @@ class SessionController < ApplicationController def failed_to_login(user) message = user.suspend_reason ? "login.suspended_with_reason" : "login.suspended" - render json: { error: I18n.t(message, { date: I18n.l(user.suspended_till, format: :date_only), - reason: user.suspend_reason}) } + render json: { + error: I18n.t(message, { date: I18n.l(user.suspended_till, format: :date_only), reason: user.suspend_reason}), + reason: 'suspended' + } end def login(user)