本文整理匯總了Java中com.parse.ParseUser.requestPasswordResetInBackground方法的典型用法代碼示例。如果您正苦於以下問題:Java ParseUser.requestPasswordResetInBackground方法的具體用法?Java ParseUser.requestPasswordResetInBackground怎麽用?Java ParseUser.requestPasswordResetInBackground使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.parse.ParseUser
的用法示例。
在下文中一共展示了ParseUser.requestPasswordResetInBackground方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onClick
import com.parse.ParseUser; //導入方法依賴的package包/類
@Override
public void onClick(View v) {
if(!validate()) {
return;
}
if (!emailSent) {
loadingStart();
ParseUser.requestPasswordResetInBackground(emailField.getText().toString(),
new RequestPasswordResetCallback() {
@Override
public void done(ParseException e) {
if (isActivityDestroyed()) {
return;
}
loadingFinish();
if (e == null) {
instructionsTextView.setText(R.string.helpSuccess);
emailField.setVisibility(View.INVISIBLE);
submitButton.setText(R.string.helpBackToLogin);
emailSent = true;
} else {
if (e.getCode() == ParseException.INVALID_EMAIL_ADDRESS ||
e.getCode() == ParseException.EMAIL_NOT_FOUND) {
showToast(R.string.invalidEmail);
} else {
showToast(R.string.unknownHelpError);
}
}
}
});
} else {
onLoginHelpSuccessListener.onLoginHelpSuccess();
}
}
示例2: initForgotPass
import com.parse.ParseUser; //導入方法依賴的package包/類
public void initForgotPass(final View v) {
if (mEmailField.getText().length() == 0) {
mErrorField.setText("Please enter a valid email address.");
return;
}
v.setEnabled(false);
spinner.setVisibility(View.VISIBLE);
mErrorField.setText("");
InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.hideSoftInputFromWindow(mEmailField.getWindowToken(), 0);
ParseUser.requestPasswordResetInBackground(mEmailField.getText().toString(), new RequestPasswordResetCallback() {
public void done(ParseException e) {
if (e == null) {
spinner.setVisibility(View.GONE);
Toast.makeText(ForgotPassActivity.this, "Password reset instructions sent!",
Toast.LENGTH_LONG).show();
Intent intent = new Intent(ForgotPassActivity.this,
LoginActivity.class);
startActivity(intent);
finish();
// An email was successfully sent with reset instructions.
} else {
v.setEnabled(true);
spinner.setVisibility(View.GONE);
mErrorField.setText("Sorry, password reset failed. Please try again.");
}
}
});
}
示例3: sentPassword
import com.parse.ParseUser; //導入方法依賴的package包/類
public void sentPassword(String email) {
ParseUser.requestPasswordResetInBackground(email, new RequestPasswordResetCallback() {
public void done(ParseException e) {
if (e == null) {
handler.sendEmptyMessage(CONNECTION_OK);
} else {
handler.sendEmptyMessage(0);
}
}
});
}
示例4: onClick
import com.parse.ParseUser; //導入方法依賴的package包/類
@Override
public void onClick(View v) {
if (!emailSent) {
String email = emailField.getText().toString();
if (email.length() == 0) {
showToast(R.string.com_parse_ui_no_email_toast);
} else {
loadingStart();
ParseUser.requestPasswordResetInBackground(email,
new RequestPasswordResetCallback() {
@Override
public void done(ParseException e) {
if (isActivityDestroyed()) {
return;
}
loadingFinish();
if (e == null) {
instructionsTextView
.setText(R.string.com_parse_ui_login_help_email_sent);
emailField.setVisibility(View.INVISIBLE);
submitButton
.setText(R.string.com_parse_ui_login_help_login_again_button_label);
emailSent = true;
} else {
debugLog(getString(R.string.com_parse_ui_login_warning_password_reset_failed) +
e.toString());
if (e.getCode() == ParseException.INVALID_EMAIL_ADDRESS ||
e.getCode() == ParseException.EMAIL_NOT_FOUND) {
showToast(R.string.com_parse_ui_invalid_email_toast);
} else {
showToast(R.string.com_parse_ui_login_help_submit_failed_unknown);
}
}
}
});
}
} else {
onLoginHelpSuccessListener.onLoginHelpSuccess();
}
}