我想运行一个查询,让用户手动更改密码。可能吗 ?如果有,怎么样?我知道无法修改用户表中的密码字段。有没有办法不使用parse.com的重置方法
ParseQuery<ParseUser> query = ParseUser.getQuery();
query.whereEqualTo("username", user.getUsername());
query.findInBackground(new FindCallback<ParseUser>() {
public void done(List<ParseUser> objects,
ParseException e) {
if (e == null) {
// The query was successful.
for (ParseUser ob : objects) {
ob.put("password", newpass1);
//user.setPassword(newpass1);
}
Toast.makeText(getApplicationContext(),
"Password Changed !", Toast.LENGTH_LONG)
.show();
progress.dismiss();
finish();
} else {
// Something went wrong.
}
}
});
答案 0 :(得分:4)
您是否尝试设置当前用户的密码?如果是这样,只需使用以下代码:
ParseUser currentUser = ParseUser.getCurrentUser();
currentUser.setPassword("new_password");
currentUser.saveInBackground();
答案 1 :(得分:1)
您只能为当前用户设置密码:
ParseUser currentUser = ParseUser.getCurrentUser();
currentUser.setPassword("newpassword");
currentUser.saveInBackground();
您永远不会查询当前用户的ParseUser对象,而是使用ParseUser.getCurrentUser();