Java 类com.parse.RequestPasswordResetCallback 实例源码

项目:cat-chat-android    文件:LoginActivity.java   
private void resetPassword() {
    ParseUser.requestPasswordResetInBackground(getEmailAddress(), new RequestPasswordResetCallback() {
        @Override
        public void done(ParseException e) {
            if (e == null) {
                Toast.makeText(LoginActivity.this, R.string.password_reset_email_sent, Toast.LENGTH_SHORT).show();

                mResetPasswordInitialised = false;
                mLoginButton.setText(R.string.log_in);
                mPasswordEditText.animate().setDuration(500).alpha(1);
            } else {
                mEmailEditText.setError(e.getMessage());
            }
        }
    });
}
项目:CloudyPhone    文件:ResetPasswordClickListener.java   
@Override
public void onClick(View v) {
    EditText email = emailReference.get();

    String emailString = email.getText().toString();

    boolean validEmail = InputValidator.validateEmail(emailString);

    if (!validEmail) {
        email.setError(context.getString(R.string.email_error));
    } else {
        // everything is ok
        ProgressDialog progressDialog = ProgressDialog.show(context, "",
                context.getString(R.string.resetting));
        progressDialog.setCancelable(true);

        RequestPasswordResetCallback callback = new MyResetPasswordCallback(
                context, progressDialog);

        ParseUser.requestPasswordResetInBackground(emailString, callback);
    }
}
项目:Coins    文件:ResetPasswordDialog.java   
/**
 */
public void clickedReset()
{
    InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(mUsername.getWindowToken(), 0);
    ParseUser.requestPasswordResetInBackground(mUsername.getText().toString(), new RequestPasswordResetCallback()
    {
        @Override
        public void done(ParseException e)
        {
            Toast.makeText(mContext, "Please check your inbox for \"" +
                    mUsername.getText().toString() + "\"", Toast.LENGTH_LONG).show();
            mDialog.dismiss();
        }
    });
}
项目:ExpertAndroid    文件:ResetPasswordActivity.java   
public void resetPassword(View view) {
    if (!this.validateForm()) {
        return;
    }

    String email = this.getEmail();
    this.turnOnProgressDialog("Reset Password", "Wait while we send you email with password reset");

    ParseUser.requestPasswordResetInBackground(email, new RequestPasswordResetCallback() {
        @Override
        public void done(ParseException e) {
            turnOffProgressDialog();

            if (e == null) {
                reportSuccessfulReset();
            } else {
                reportResetError(e);
            }
        }
    });
}
项目:ExpertAndroid    文件:PasswordResetActivity.java   
public void resetPassword(View v)
{
    if (validateForm() == false){
        return;
    }
    String sEmail = email.getText().toString(); 
    turnOnProgressDialog("Reset Password","Wait while we send you email with password reset");
    //userid is there
    ParseUser.requestPasswordResetInBackground(sEmail,
               new RequestPasswordResetCallback() {
                public void done(ParseException e) {
                    turnOffProgressDialog();
                    if (e == null) {
                        reportSuccessfulReset();
                    } else {
                        reportResetError(e);
                    }
            }
    });
    }
项目:libertacao-android    文件:ParseLoginHelpFragment.java   
@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();
    }
}
项目:TemplateAppParse-dot-com    文件:ForgotPassActivity.java   
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.");
                }
            }
        });
    }
项目:AutoTimeHelper    文件:UserAPI.java   
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);
            }
        }
    });
}
项目:libertacao-android    文件:ParseLoginHelpFragment.java   
@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();
  }
}
项目:SyncNotes    文件:ParseLoginHelpFragment.java   
@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();
  }
}
项目:AutoTimeHelper    文件:ParseLoginHelpFragment.java   
@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();
  }
}
项目:WatsiAndroidApp    文件:ParseLoginHelpFragment.java   
@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();
  }
}
项目:AndroidClient    文件:ParseLoginHelpFragment.java   
@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();
  }
}