To reset the password, Parse provide us RequestPasswordResetCallback to requesting a password to reset for an existing user.
I implement it using anonymous inner class. So then override the done() method where we can do whatever we want after the request completes.
We just need to provide email address for we want to reset the password.
A message will send to the provided email containing a link to reset your password.
Below is the code:
ParseUser.requestPasswordResetInBackground(mEmailId.getText().toString().toLowerCase(),
new RequestPasswordResetCallback() {
public void done(ParseException e) {
if (e == null) {
Toast.makeText(EditPasswordActivity.this, "Please check your email.", Toast.LENGTH_LONG).show();
finish();
// An email was successfully sent with reset instructions.
} else {
Toast.makeText(EditPasswordActivity.this, "Error :: " + e.getMessage(), Toast.LENGTH_LONG).show();
// Something went wrong. Look at the ParseException to see what's up.
}
}
});
} else {
Toast.makeText(this, R.string.you_are_not_connected_with_internet, Toast.LENGTH_SHORT).show();
}
0 Comment(s)