如何在解析Android上使用旧密码更改密码 [英] How to change password using old password on parse android

查看:63
本文介绍了如何在解析Android上使用旧密码更改密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Android应用程序,用户可以在其中更改他/她的密码,我的问题是我如何使用parse验证用户的旧密码,我有3个编辑文本旧密码,新密码并确认新密码".

I have an android app in which user can change his/her password my problem is how i can verify old password of user using parse i have 3 edit text "old password, new password and confirm new password".

我在parse.com上搜索,但是找不到任何解析的解决方案,因此无法使用获取密码来获取数据. 我正在这样做

I search on parse.com but can't find any solution parse do not fetch data using get password. i am doing this

String get_confrimpass=currentuser.getpassword();



if(get_confrimpass.replaceAll("\\s", "").equals(current_pass_check))
            {           }

推荐答案

您可以尝试使用当前用户名和密码给他们登录.如果登录成功,则旧密码正确.即

You can try logging them in using there current username and the password that they have given to you. If the loggin is successful the old password is correct. I.e

ParseUser.logInInBackground(ParseUser.getCurrentUser().getUsername(), currentPassword, new LogInCallback() {  
    public void done(ParseUser user, ParseException e) {    
        if (user != null) {      
             // Hooray! The password is correct 
        } else {      
             // The password was incorrect 
        }  
   }
});

在上面的示例中,"currentPassword"变量是您将从旧密码" EditText中检索的文本

In the example above the 'currentPassword' variable is the text that you would retreive from the 'Old Password' EditText

这篇关于如何在解析Android上使用旧密码更改密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆