gpt4 book ai didi

android - 如何修复 Parse 中的“无效用户名/密码”

转载 作者:行者123 更新时间:2023-11-29 02:22:27 25 4
gpt4 key购买 nike

我正在开发一个应用程序,它有 signupLogin 使用解析服务器,我可以在其中注册但是当我尝试登录时它给了我异常

"Invalid username/password"

这是 signUpLogIn 的代码,当 signUpMode 处于 Activity 状态时,用户通过按下按钮进行注册,或者当 signUpmode 处于停用状态时,即 false 按钮​​充当登录,用户可以登录,但是当我尝试登录时,它说 “无效的用户名/密码”

  public void signUp(View view)
{
editTextUser =(EditText) findViewById(R.id.userNameEdit);
editTextPass =(EditText) findViewById(R.id.passWordEdit);

if(editTextUser.getText().toString().matches("") || editTextPass.getText().toString().matches(""))
{
Toast.makeText(this,"Username and Password required",Toast.LENGTH_SHORT).show();
}
else
{
if(SignupModeActive)
{
ParseUser user = new ParseUser();
user.setUsername(editTextUser.getText().toString());
user.setPassword(editTextUser.getText().toString());
user.signUpInBackground(new SignUpCallback() {
@Override
public void done(ParseException e) {

if(e == null)
{
Log.i("saveInBackGround","SignUp Success");
Intent intent = new Intent(MainActivity.this,UserslistActivity.class);
startActivity(intent);
}
else{
Toast.makeText(MainActivity.this,e.getMessage(),Toast.LENGTH_SHORT).show();
}


}
});


}
else
{
ParseUser.logInInBackground(editTextUser.getText().toString(),editTextPass.getText().toString(), new LogInCallback() {
@Override
public void done(ParseUser user, ParseException e) {
if(user != null){
Log.i("LogInBackGround","Login Succesfull");
Intent logInintent = new Intent(MainActivity.this,UserslistActivity.class);
startActivity(logInintent);
}
else
{
Toast.makeText(MainActivity.this,e.getMessage(),Toast.LENGTH_LONG).show();
}
}
});
}


}



}

最佳答案

//检查异常

public void signUp(View view)
{
mEditTextUser =(EditText) findViewById(R.id.userNameEdit);
mEditTextPass =(EditText) findViewById(R.id.passWordEdit);

if(mEditTextUser .getText().toString().trim().length()==0 || editTextPass.getText().toString().trim().length()==0.matches(""))
{
Toast.makeText(this,"Username and Password required",Toast.LENGTH_SHORT).show();
}
else
{
//Check SignupMode is true
if(SignupModeActive)
{
ParseUser user = new ParseUser();
user.setUsername(editTextUser.getText().toString());
user.setPassword(editTextUser.getText().toString());
user.signUpInBackground(new SignUpCallback() {
@Override
public void done(ParseException e) {

if(e == null)
{
Log.e("Exception",e.printStackTrace());
Intent intent = new Intent(MainActivity.this,UserslistActivity.class);
startActivity(intent);
}
else{
Toast.makeText(MainActivity.this,e.getMessage(),Toast.LENGTH_SHORT).show();
}


}
});


}
else
{
ParseUser.logInInBackground(editTextUser.getText().toString(),editTextPass.getText().toString(), new LogInCallback() {
@Override
public void done(ParseUser user, ParseException e) {
if(user != null){
Log.i("LogInBackGround","Login Succesfull");
Intent logInintent = new Intent(MainActivity.this,UserslistActivity.class);
startActivity(logInintent);
}
else
{
Toast.makeText(MainActivity.this,e.getMessage(),Toast.LENGTH_LONG).show();
}
}
});
}


}



}

关于android - 如何修复 Parse 中的“无效用户名/密码”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54529977/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com