为什么认证被绕过
Why authentication is bypass
我使应用程序 android 与 codeigniter 连接,但为什么我输入了错误的用户名和密码,身份验证不起作用。就像绕过了MainActivity.class,请问有什么问题吗?
这是我的代码:
public void onClick(View view){
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
RequestBody formBody = new FormBody.Builder().add("username_kirim", username.getText().toString())
.add("password_kirim", password.getText().toString())
.build();
Request request = new Request.Builder().url(url_login).post(formBody).build();
try {
Response response = client.newCall(request).execute();
if(!response.isSuccessful()){
throw new IOException("Gagal Terkoneksi" + response);
}
if(response.isSuccessful()){
if(checkFlag){
editor.putString("username", username.getText().toString());
editor.putString("password", password.getText().toString());
editor.apply();
}
Intent loged = new Intent(LoginActivity.this, MainActivity.class);
startActivity(loged);
}
}
catch (IOException e){
e.printStackTrace();
}
}
仅仅因为查询成功并不意味着它有数据,0行仍然可以成功执行查询。
我使应用程序 android 与 codeigniter 连接,但为什么我输入了错误的用户名和密码,身份验证不起作用。就像绕过了MainActivity.class,请问有什么问题吗?
这是我的代码:
public void onClick(View view){
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
RequestBody formBody = new FormBody.Builder().add("username_kirim", username.getText().toString())
.add("password_kirim", password.getText().toString())
.build();
Request request = new Request.Builder().url(url_login).post(formBody).build();
try {
Response response = client.newCall(request).execute();
if(!response.isSuccessful()){
throw new IOException("Gagal Terkoneksi" + response);
}
if(response.isSuccessful()){
if(checkFlag){
editor.putString("username", username.getText().toString());
editor.putString("password", password.getText().toString());
editor.apply();
}
Intent loged = new Intent(LoginActivity.this, MainActivity.class);
startActivity(loged);
}
}
catch (IOException e){
e.printStackTrace();
}
}
仅仅因为查询成功并不意味着它有数据,0行仍然可以成功执行查询。