有一两件事你可以做的是做事情的注册功能的回调函数,该函数注册做回一个承诺。你可以做这样的事情:
firebase.auth().createUserWithEmailAndPassword(email, password)
.then(function(user) {
//I believe the user variable here is the same as firebase.auth().currentUser
//take the user to some form you want them to fill
})
.catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// ...
});
不过,我真的不建议做这种方式,因为客户端代码是不可靠的。想一想,如果用户在填写表单之前突然断开连接,该怎么办?他们的数据在您的数据库中不完整。因此,如果您这样做,请在提交表单时在用户个人资料中设置一个标志,以便知道谁填充了详细信息,谁不填写。
另一个更好的方法是使用firebase云功能。你可以在你的云功能中拥有这样的代码。云功能是用node.js编写的,所以你不需要花时间在另一种语言上。
exports.someoneSignedUp = functions.auth.user().onCreate(event => {
// you can send them a cloud function to lead them to the detail information form
//or you can send them an welcome email which will also lead them to where you want them to fill detailed information
});
这种方式好多了,因为您可以安全地假设您的云服务器永远不会关闭或受到威胁。有关云功能的更多信息,请参阅他们的文档:https://firebase.google.com/docs/functions/auth-events
我将用户存储在数据库中,并带有“onboarded”字段。我检查了这一点,以确保它们在继续使用之前已经上报。在此身份验证状态中没有“开箱即用”功能。 – theblindprophet