0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

More serverside notificaiton HTML fixes

refs #4964, #4969
This commit is contained in:
Hannah Wolfe 2015-03-01 12:33:00 +00:00
parent 8432215cd9
commit 884d766afe
3 changed files with 9 additions and 2 deletions

View file

@ -100,11 +100,13 @@ NavigationController = Ember.Controller.extend({
blogUrl = this.get('config').blogUrl,
blogUrlRegex = new RegExp('^' + blogUrl + '(.*)', 'i'),
navItems = this.get('navigationItems'),
message = 'One of your navigation items has an empty label. ' +
'<br /> Please enter a new label or delete the item before saving.',
match;
// Don't save if there's a blank label.
if (navItems.find(function (item) { return !item.get('isComplete') && !item.get('last');})) {
self.notifications.showErrors(['One of your navigation items has an empty label.<br>Please enter a new label or delete the item before saving.']);
self.notifications.showErrors([message.htmlSafe()]);
return;
}

View file

@ -55,6 +55,11 @@ ApplicationRoute = Ember.Route.extend(SimpleAuth.ApplicationRouteMixin, Shortcut
sessionAuthenticationFailed: function (error) {
if (error.errors) {
// These are server side errors, which can be marked as htmlSafe
error.errors.forEach(function (err) {
err.message = err.message.htmlSafe();
});
this.notifications.showErrors(error.errors);
} else {
// connection errors don't return proper status message, only req.body

View file

@ -644,7 +644,7 @@ User = ghostBookshelf.Model.extend({
if (!matched) {
return Promise.resolve(self.setWarning(user, {validate: false})).then(function (remaining) {
s = (remaining > 1) ? 's' : '';
return Promise.reject(new errors.UnauthorizedError('Your password is incorrect.<br>' +
return Promise.reject(new errors.UnauthorizedError('Your password is incorrect. <br />' +
remaining + ' attempt' + s + ' remaining!'));
// Use comma structure, not .catch, because we don't want to catch incorrect passwords