FEATURE: show a new modal when suspended users try to log in

This commit is contained in:
Neil Lalonde 2016-02-19 12:19:20 -05:00
parent afa4e58efd
commit 97130463d6
2 changed files with 7 additions and 2 deletions

View File

@ -69,6 +69,9 @@ export default Ember.Controller.extend(ModalFunctionality, {
sentTo: result.sent_to_email, sentTo: result.sent_to_email,
currentEmail: result.current_email currentEmail: result.current_email
}); });
} else if (result.reason === 'suspended' ) {
self.send("closeModal");
bootbox.alert(result.error);
} else { } else {
self.flash(result.error, 'error'); self.flash(result.error, 'error');
} }

View File

@ -261,8 +261,10 @@ class SessionController < ApplicationController
def failed_to_login(user) def failed_to_login(user)
message = user.suspend_reason ? "login.suspended_with_reason" : "login.suspended" 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), render json: {
reason: user.suspend_reason}) } error: I18n.t(message, { date: I18n.l(user.suspended_till, format: :date_only), reason: user.suspend_reason}),
reason: 'suspended'
}
end end
def login(user) def login(user)