解密码重置

时间:2015-05-18 13:52:34

标签: java android parse-platform

我是新手解析,尝试通过以下方式重置密码:

user.requestPasswordResetInBackground(password.getText().toString(), new RequestPasswordResetCallback() {
    @Override
    public void done(com.parse.ParseException e) {
        if (e == null) {
            Toast.makeText(getApplicationContext(), "Password rest email has been sent to your inbox", Toast.LENGTH_LONG).show();


        }else if(e.getCode()== com.parse.ParseException.INVALID_EMAIL_ADDRESS){
            Toast.makeText(getApplicationContext(),"Email not found",Toast.LENGTH_LONG).show();
        }
    }
});

一切都很好,一封电子邮件将发送到收件箱,我可以告诉Parse如何验证密码至少8个字符(它甚至包括1234个字符) 谢谢

1 个答案:

答案 0 :(得分:1)

我认为您可以编写cloud code,因此在更新_User对象之前,请检查user.get("密码")。length。 像这样:

PF.Cloud.beforeSave("_User", function(request, response) {
    //Prototype linking
    var user = request.object;
    if (user.get("password").length >= 8) {
        response.success();
    } else {
        response.error("Password too short");
    }
});

有关详细信息,请访问参考:Cloud Code