我使应用程序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 - 为什么认证绕过,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41662412/

10-11 07:55