2014-04-01 62 views

回答

0

account.html页面调用updateEmail

$scope.updateEmail = function() { 
    $scope.reset(); 
    // disable bind to prevent junk data being left in firebase 
    $scope.unBindAccount(); 
    changeEmailService(buildEmailParms()); 
    }; 

它调用changeEmailService

,截至到 AccountCtrl controller
<button ng-click="updateEmail()">update email</button> 

角钩。

本质上,changeEmailService创建一个新帐户,验证它,然后删除旧帐户。然后它将数据更新到/ user路径。它使用链式承诺回调算法:

 // execute activities in order; first we authenticate the user 
     authenticate() 
      // then we fetch old account details 
      .then(loadOldProfile) 
      // then we create a new account 
      .then(createNewAccount) 
      // then we copy old account info 
      .then(copyProfile) 
      // and once they safely exist, then we can delete the old ones 
      .then(removeOldProfile) 
      .then(removeOldLogin) 
      // success 
      .then(function() { cb && cb(null) }, cb) 
      .catch(errorFn); 
+0

因此,如果用户ID是user22,然后他们改变他们的电子邮件他们的用户ID将改为说user245?如果是这样,你会如何建议让他们与他们的所有数据相关联? – Jeffrey

+0

我不确定你的用户名是什么意思。对于电子邮件/密码登录(这是您可以更改用户的电子邮件地址的唯一示例),用户标识将类似于“kato @ domain,com”,而uid将为“password:kato @ domain,com”。如果您允许用户更改其电子邮件地址,那么您必须相应地更新其数据。 – Kato

+0

当我按照火力示例代码我结束了如下的结构:使用者[simplelogin:1 [电子邮件地址:名@ address.com,名称:乔],simplelogin:2 [电子邮件地址:..,名称:..]] 。如果我更改了电子邮件地址,它会在我刚刚列出的json中更改我的电子邮件,但在Firebase管理控制台简单登录选项卡下的“注册用户”列表中,电子邮件地址不会更改。如果我更改了我的电子邮件地址,它只会出现在json文件中,我需要使用我注册的电子邮件地址登录。我正在寻找一种方法来更改这两个电子邮件,同时保持我的json数据链接仍然是相同的uid(simplelogin:1)。 – Jeffrey

相关问题