diff options
author | Robert Kowalski <rok@kowalski.gd> | 2014-03-25 22:05:19 +0100 |
---|---|---|
committer | Garren Smith <garren.smith@gmail.com> | 2014-03-26 10:17:51 +0200 |
commit | 827b84891d5c16a4e5c2b692d3694fe2ba4a1210 (patch) | |
tree | eed26be8659d8b3af452dab67c7ca11d945571fb | |
parent | 1fb7cea25b60585b16bdd786cd3e2b299fa384df (diff) | |
download | couchdb-827b84891d5c16a4e5c2b692d3694fe2ba4a1210.tar.gz |
Readd 'Could not create admin.' to the beginning of the error message
was removed in b63ff1b50b7bde0c8f1f95988d076dda63f41fed
-rw-r--r-- | src/fauxton/app/addons/auth/resources.js | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/fauxton/app/addons/auth/resources.js b/src/fauxton/app/addons/auth/resources.js index edfd70847..ba3a438d9 100644 --- a/src/fauxton/app/addons/auth/resources.js +++ b/src/fauxton/app/addons/auth/resources.js @@ -20,7 +20,7 @@ function (app, FauxtonAPI, CouchdbSession) { var Auth = new FauxtonAPI.addon(); - var promiseErrorHandler = function (xhr, type, msg) { + var errorHandler = function (xhr, type, msg) { msg = xhr; if (arguments.length === 3) { msg = xhr.responseJSON.reason; @@ -72,7 +72,8 @@ function (app, FauxtonAPI, CouchdbSession) { passwordsNotMatch: 'Passwords do not match.', loggedIn: 'You have been logged in.', adminCreated: 'CouchDB admin created', - changePassword: 'Your password has been updated.' + changePassword: 'Your password has been updated.', + adminCreationFailedPrefix: 'Could not create admin.' }, options.messages); }, @@ -245,7 +246,14 @@ function (app, FauxtonAPI, CouchdbSession) { } }); - promise.fail(promiseErrorHandler); + promise.fail(function (xhr, type, msg) { + msg = xhr; + if (arguments.length === 3) { + msg = xhr.responseJSON.reason; + } + msg = FauxtonAPI.session.messages.adminCreationFailedPrefix + ' ' + msg; + errorHandler(msg); + }); } }); @@ -279,7 +287,7 @@ function (app, FauxtonAPI, CouchdbSession) { FauxtonAPI.navigate('/'); }); - promise.fail(promiseErrorHandler); + promise.fail(errorHandler); } }); @@ -306,7 +314,7 @@ function (app, FauxtonAPI, CouchdbSession) { that.$('#password-confirm').val(''); }); - promise.fail(promiseErrorHandler); + promise.fail(errorHandler); } }); |