couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [07/49] git commit: updated refs/heads/1867-feature-plugins to d269b53
Date Fri, 02 Aug 2013 20:08:21 GMT
Fauxton Auth default messages for errors


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/4479b861
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/4479b861
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/4479b861

Branch: refs/heads/1867-feature-plugins
Commit: 4479b861ba05ef4c38cbade4a8ecaea9c4901954
Parents: a183999
Author: Garren Smith <garren.smith@gmail.com>
Authored: Tue Jul 30 10:41:40 2013 +0200
Committer: Garren Smith <garren.smith@gmail.com>
Committed: Tue Jul 30 18:17:49 2013 +0200

----------------------------------------------------------------------
 src/fauxton/app/addons/auth/resources.js | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/4479b861/src/fauxton/app/addons/auth/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/auth/resources.js b/src/fauxton/app/addons/auth/resources.js
index e610951..7118c70 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; }
 


Mime
View raw message