如何在Flutter中使用Firebase更改密码 [英] How to change password using Firebase in Flutter
本文介绍了如何在Flutter中使用Firebase更改密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在Flutter中使用Firebase更改当前用户密码。
有人可以帮我实现更改密码的方法吗?
I want to change current user password using Firebase in Flutter. Can any one help me on how to implement change password method?
推荐答案
我知道这是最新文章,但是现在可以更改已登录用户的密码。由于这是一项敏感操作,因此请确保通知用户再次登录。
I know this is a late post, but now it's possible to change the password of the logged-in user. Make sure to notify the user to log in again since this is a sensitive operation.
void _changePassword(String password) async{
//Create an instance of the current user.
FirebaseUser user = await FirebaseAuth.instance.currentUser();
//Pass in the password to updatePassword.
user.updatePassword(password).then((_){
print("Succesfull changed password");
}).catchError((error){
print("Password can't be changed" + error.toString());
//This might happen, when the wrong password is in, the user isn't found, or if the user hasn't logged in recently.
});
}
这篇关于如何在Flutter中使用Firebase更改密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文