From 06736f37c536c5a2d074bbc801845519cfcbbbb6 Mon Sep 17 00:00:00 2001
From: Lloyd Hilaiel <lloyd@hilaiel.com>
Date: Tue, 10 Jul 2012 09:26:50 -0600
Subject: [PATCH] fix JSON db bug in completeAddEmail, we would always reset
 user's password to null

---
 lib/db/json.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/db/json.js b/lib/db/json.js
index 5ff3d50a9..0998f8803 100644
--- a/lib/db/json.js
+++ b/lib/db/json.js
@@ -298,7 +298,7 @@ exports.completeAddEmail = function(secret, cb) {
       function addIt() {
         addEmailToAccount(o.existing_user, o.email, 'secondary', function(e) {
           var hash = o.passwd;
-          if(e || hash === null) return cb(e, o.email, o.existing_user);
+          if(e || typeof hash !== 'string') return cb(e, o.email, o.existing_user);
 
           // a hash was specified, update the password for the user
           exports.emailToUID(o.email, function(err, uid) {
-- 
GitLab