summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarren Smith <garren.smith@gmail.com>2013-07-30 10:41:40 +0200
committerGarren Smith <garren.smith@gmail.com>2013-07-30 18:17:49 +0200
commit4479b861ba05ef4c38cbade4a8ecaea9c4901954 (patch)
treeae261c282aaf9830e8c1ed8df7f9db28ffa3ac1d
parenta18399980c7d293c3ac15350c1c9b0e1071d0b96 (diff)
downloadcouchdb-4479b861ba05ef4c38cbade4a8ecaea9c4901954.tar.gz
Fauxton Auth default messages for errors
-rw-r--r--src/fauxton/app/addons/auth/resources.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/fauxton/app/addons/auth/resources.js b/src/fauxton/app/addons/auth/resources.js
index e6109511c..7118c701c 100644
--- a/src/fauxton/app/addons/auth/resources.js
+++ b/src/fauxton/app/addons/auth/resources.js
@@ -49,6 +49,15 @@ function (app, FauxtonAPI) {
Auth.Session = FauxtonAPI.Session.extend({
url: '/_session',
+ initialize: function (options) {
+ if (!options) { options = {}; }
+
+ this.messages = _.extend({}, {
+ missingCredentials: 'Username or password cannot be blank.',
+ passwordsNotMatch: 'Passwords do not match.'
+ }, options.messages);
+ },
+
isAdminParty: function () {
var userCtx = this.get('userCtx');
@@ -104,7 +113,7 @@ function (app, FauxtonAPI) {
createAdmin: function (username, password, login) {
var that = this,
- error_promise = this.validateUser(username, password, 'Username or password cannot be blank.');
+ error_promise = this.validateUser(username, password, this.messages.missingCredentials);
if (error_promise) { return error_promise; }
@@ -123,7 +132,7 @@ function (app, FauxtonAPI) {
},
login: function (username, password) {
- var error_promise = this.validateUser(username, password, 'Username or password cannot be blank.');
+ var error_promise = this.validateUser(username, password, this.messages.missingCredentials);
if (error_promise) { return error_promise; }
@@ -154,7 +163,7 @@ function (app, FauxtonAPI) {
},
changePassword: function (password, password_confirm) {
- var error_promise = this.validatePasswords(password, password_confirm, 'Passwords do not match.');
+ var error_promise = this.validatePasswords(password, password_confirm, this.messages.passwordsNotMatch);
if (error_promise) { return error_promise; }