团队冲刺
第六天
完善了修改密码的页面
并且可以发验证码注册了
每天上限20条验证码
Button btn_change_password_ok = findViewById(R.id.btn_change_password_ok);
btn_change_password_ok.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
EditText oldpassword=findViewById(R.id.et_oldpassword);
EditText newpassword=findViewById(R.id.et_newpassword);
if(!oldpassword.getText().toString().equals("")&&!newpassword.getText().toString().equals("")
&&newpassword.getText().toString().length()>=6){
BmobQuery<Bean> b = new BmobQuery<>();
b.addWhereEqualTo("Phone",phone);
b.findObjects(new FindListener<Bean>() {
@Override
public void done(List<Bean> list, BmobException e) {
if(e == null){
if(list.size()>0){
if(oldpassword.getText().toString().equals(list.get(0).Password)){
Bean bean = new Bean();
bean.Password=newpassword.getText().toString();
bean.State="F";
bean.update(id, new UpdateListener() {
@Override
public void done(BmobException e) {
if(e==null){
Toast.makeText(ChangePassword.this,"修改成功,请重新登录!",Toast.LENGTH_SHORT).show();
Intent intent = new Intent(ChangePassword.this, Login.class);
startActivity(intent);
finish();
}
}
});
}else
Toast.makeText(ChangePassword.this,"原密码错误!",Toast.LENGTH_SHORT).show();
}
}
}
});
}else {
Toast.makeText(ChangePassword.this,"原密码或新密码填写错误!",Toast.LENGTH_SHORT).show();