在更改密码之前,验证用户输入的密码在解析服务器上保存的用户密码
我正在使用parse.com作为后端支持来处理一个应用程序。我已经使用此代码实现了更改密码,
if (pwdController!.text == newpwdController!.text) {
user.password = pwdController!.text;
await user.save();
我希望用户在允许它们更改为新密码之前输入当前密码,但是当我尝试从它返回null的parseuser对象,我看到的所有其他类似的问题,例如this 在parse.com中使用parseuser更改密码并忘记了密码未验证用户具有正确的当前密码。在让他们更改之前,如何验证用户输入的密码是当前密码?
I am working on an application using Parse.com as backend support.I have implemented change Password using this code
if (pwdController!.text == newpwdController!.text) {
user.password = pwdController!.text;
await user.save();
I want the user to enter the current password before allowing them change it to a new one but when I try to get the current password from the parseuser object it returns null, all the other similar questions I've seen such as this Change Password and Forgot Password with ParseUser in Parse.com aren't validating that the user has the correct current password. How can I validate that the password entered by user is their current password before letting them change it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过调用Parseuser.login方法使用用户名和输入密码来验证用户输入正确的当前密码。然后检查它是否返回成功的响应。
上面的代码片段假设您有两个TextController(当前密码的oldpwdController,以及用于更改为新密码的PWDController)。
You can verify that the user has entered the correct current password by calling the ParseUser.login method with the username and entered password. Then check if it returns a successful response.
The snippet of code above assumes that you have two textcontrollers(oldpwdController for current password, and pwdController for new password to change to).