title: Android - Make app login, case sensitive
body: <p>I am building a native Android app. I have a login page which is not case sensitive. </p>
  
  <p>Example: both password's <strong>Admin</strong> and <strong>admin</strong> will allow the user to login. This should not be possible.</p>
  
  <p>The login is working. My problem is making it case sensitive. I am still new to Java and Android, and not sure where to put the code to make it case sensitive.<br><br>
  Should i use equalsIgnoreCase()? <br>If so, how would you use equalsIgnoreCase() in this login. Where do you compere the user login with the Rest API</p>
  
  <p>Any help would be appropriated.</p>
  
  <pre><code>private class LoginProcess extends AsyncTask&lt;Void, Void, String&gt; {
  
      protected void onPreExecute(){
          super.onPreExecute();
          dialog_login.show();
      }
  
      String user = userInput.getText().toString();
      String pass = passInput.getText().toString();
  
      @Override
      protected String doInBackground(Void... voids) {
  
          String address = my_url + "api/user/login.json";
  
          HttpURLConnection urlConnection;
          String requestBody;
          Uri.Builder builder = new Uri.Builder();
  
          Map&lt;String, String&gt; params = new HashMap&lt;&gt;();
          params.put("username", user);
          params.put("password", pass);
  
          Iterator entries = params.entrySet().iterator();
          while (entries.hasNext()) {
              Map.Entry entry = (Map.Entry) entries.next();
              builder.appendQueryParameter(entry.getKey().toString(), entry.getValue().toString());
              entries.remove();
          }
          requestBody = builder.build().getEncodedQuery();
  
          try {
              URL url = new URL(address);
              urlConnection = (HttpURLConnection) url.openConnection();
              urlConnection.setDoOutput(true);
              urlConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
              OutputStream outputStream = new BufferedOutputStream(urlConnection.getOutputStream());
              BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outputStream, "utf-8"));
              writer.write(requestBody);
              writer.flush();
              writer.close();
              outputStream.close();
              JSONObject jsonObject = new JSONObject();
              InputStream inputStream;
              // get stream
              if (urlConnection.getResponseCode() &lt; HttpURLConnection.HTTP_BAD_REQUEST) {
                  inputStream = urlConnection.getInputStream();
                  Log.w("URL", "Ok");
              } else {
                  inputStream = urlConnection.getErrorStream();
                  Log.w("URL", "Bad request");
              }
  
              // parse stream
              BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
              String temp, response = "";
              while ((temp = bufferedReader.readLine()) != null) {
                  response += temp;
              }
              // put into JSONObject
              jsonObject.put("Content", response);
              jsonObject.put("Message", urlConnection.getResponseMessage());
              jsonObject.put("Length", urlConnection.getContentLength());
              jsonObject.put("Type", urlConnection.getContentType());
  
              JSONObject jsonObj = new JSONObject(response);
              session_name = jsonObj.getString("session_name");
              session_id = jsonObj.getString("sessid");
              token = jsonObj.getString("token");
  
              return jsonObject.toString();
  
          } catch (IOException | JSONException e) {
              return e.toString();
          }
      }
  </code></pre>