                 client.print("{\"response\":\"non-active\"}");
               }
             }
+            else if(type == 'f') {
+              client.println("HTTP/1.1 200 OK");
+              client.println("Content-Type: application/json");
+              client.println();
+              client.print("{\"response\":\"false\"}");
+              wrong_password();
+            }
             else {
               Serial.print("Unexpected type ");
               Serial.print(type);

    delay(10);
    client.stop();
  }
  if(digitalRead(push_btn) == LOW){
    auth_user("keluar");
    open_door();
  }

  if(device_status){
    char key = keypad.getKey();
    if (key != NO_KEY && key != '*'){
      pass[count] = key;
      count++;
    }
    if(key == '*'){
      attempt++;
      auth_user(pass);
      sys_init();

  }
  else{
    Serial.println("Sending failed");
    String pass(user_input);
    if(pass == "123"){
      if(pass != "keluar"){
        open_door();
      }
    }
    else{
      wrong_password();
    }
  }
}

void open_door(){
  Serial.println("Door open");
  attempt = 0;
  myservo.write(30);
  delay(3000);
  while(digitalRead(sensor) == HIGH);
  delay(1000);
  myservo.write(70);
  Serial.println("Door closed");
  idleTime = millis();
}

boolean device_isLock(){
  if(attempt >= 3){
    //Serial.println("Device lock");
    return true;
  }
  else{
    //Serial.println("Device unlock");
    return false;
  }
}

void wrong_password(){
  Serial.println("Wrong Password");
  idleTime = millis();
}
