add an alert when trying to login while in read-only mode

This commit is contained in:
Régis Hanol 2014-02-13 08:33:40 -08:00
parent 38e365ea45
commit 0e941a6253
3 changed files with 11 additions and 4 deletions

View File

@ -31,7 +31,7 @@ Discourse.addInitializer(function() {
Discourse.MessageBus.subscribe("/global/read-only", function (enabled) { Discourse.MessageBus.subscribe("/global/read-only", function (enabled) {
Discourse.set("isReadOnly", enabled); Discourse.set("isReadOnly", enabled);
if (enabled && !Discourse.User.currentProp("hideReadOnlyAlert")) { if (enabled && !Discourse.User.currentProp("hideReadOnlyAlert")) {
bootbox.alert(I18n.t("read_only_mode_enabled")); bootbox.alert(I18n.t("read_only_mode.enabled"));
} }
}); });

View File

@ -11,8 +11,12 @@ Discourse.ApplicationRoute = Em.Route.extend({
actions: { actions: {
showLogin: function() { showLogin: function() {
Discourse.Route.showModal(this, 'login'); if (Discourse.get("isReadOnly")) {
this.controllerFor('login').resetForm(); bootbox.alert(I18n.t("read_only_mode.login_disabled"));
} else {
Discourse.Route.showModal(this, 'login');
this.controllerFor('login').resetForm();
}
}, },
showCreateAccount: function() { showCreateAccount: function() {

View File

@ -411,7 +411,10 @@ en:
loading: "Loading..." loading: "Loading..."
close: "Close" close: "Close"
assets_changed_confirm: "Discourse has been updated, would you like to refresh to get the latest version?" assets_changed_confirm: "Discourse has been updated, would you like to refresh to get the latest version?"
read_only_mode_enabled: "An administrator has enabled read-only mode. You can continue to browse the site but interations won't work properly." read_only_mode:
enabled: "An administrator has enabled read-only mode. You can continue to browse the site but interations won't work properly."
login_disabled: "Login is disabled while the site is in read only mode."
learn_more: "learn more..." learn_more: "learn more..."
year: 'year' year: 'year'