<?php include 'header.php'; ?>
    <script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@8"></script>

    <style type="text/css">
        


html, body {
  width: 100%;
  height:100%;
}

body {
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradient 15s ease infinite;
}

@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@font-face {
  font-family: myFirstFont;
  src: url(relate3.ttf);
  font-weight: bold;
}

    </style>

<script type="text/javascript">
	

$( document ).ready(function() {
	// $( "body" ).addClass( "bodysec" );
$('#normalheader').hide();
$('#altmenu').hide();
});

function girisYap(){
  document.getElementById("email1").disabled = true;
  document.getElementById("password1").disabled = true;
  $("#gonder").html("Lütfen Bekleyin!");

  var url = "assets/api.php";
  var bilgi = {
    type: 'login',
      email: $('#email1').val(),
      password: $('#password1').val(),
      onesignal: $('#onesignal').val()
  }

  $.post(url,bilgi,function(response) {

document.getElementById("email1").disabled = false;
document.getElementById("password1").disabled = false;
$("#gonder").html("Giriş Yap");

    var json = JSON.parse(response);
    if(json.result== "100"){
  // boş alan var
  swal.fire({
  title: 'Hata!',
  html: "Kullanıcı adı veya şifrenizi yazmadınız!",
  type: 'error',
  showCancelButton: false,
  confirmButtonColor: 'green',
  confirmButtonText: 'Tamam'
})




}else if(json.result== "101") {
// geçerli bir email değil

//alert('geçerli bir email değil');
swal.fire({
title: 'Hata!',
html: "Sadece mobil uygulamamız üzerinden kayıt olabilirsiniz!",
type: 'error',
showCancelButton: false,
confirmButtonColor: 'green',
confirmButtonText: 'Tamam'
})
    }else if(json.result== "0"){
  // kullanıcı adı veya şifre yanlış
  swal.fire({
  title: 'Hata!',
  html: "Kullanıcı adı veya şifre yanlış!",
  type: 'error',
  showCancelButton: false,
  confirmButtonColor: 'green',
  confirmButtonText: 'Tamam'
})
document.getElementById("gonder").disabled = false;
document.getElementById("username").disabled = false;
document.getElementById("password").disabled = false;
$("#gonder").html("Giriş Yap");
}else if(json.result== "1") {
Cookies.set('user_token', json.cookie, { expires: 365, domain: 'app.heysen.net' });
swal.fire({
  type: 'success',
  title: 'Giriş Yapıldı!',
  html: 'Başarılı bir şekilde giriş yapıldı, yönlendiriliyorsunuz!',
  showConfirmButton: false,
  timer: 4000
}).then(function() {
                        
 window.location.href = "bilgi_doldur.php";

})



                                       
                                   


}

})}

function goTetikle(){
Android.goLoginAc()
}

</script>
    <!-- App Capsule -->
 <style>
 .login-with-google-btn {
  transition: background-color .3s, box-shadow .3s;
    
  padding: 12px 16px 12px 42px;
  border: none;
  border-radius: 3px;
  box-shadow: 0 -1px 0 rgba(0, 0, 0, .04), 0 1px 1px rgba(0, 0, 0, .25);
  
  color: #000000;
  font-size: 14px;
  font-weight: 500;
  font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;
  
  background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNMTcuNiA5LjJsLS4xLTEuOEg5djMuNGg0LjhDMTMuNiAxMiAxMyAxMyAxMiAxMy42djIuMmgzYTguOCA4LjggMCAwIDAgMi42LTYuNnoiIGZpbGw9IiM0Mjg1RjQiIGZpbGwtcnVsZT0ibm9uemVybyIvPjxwYXRoIGQ9Ik05IDE4YzIuNCAwIDQuNS0uOCA2LTIuMmwtMy0yLjJhNS40IDUuNCAwIDAgMS04LTIuOUgxVjEzYTkgOSAwIDAgMCA4IDV6IiBmaWxsPSIjMzRBODUzIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48cGF0aCBkPSJNNCAxMC43YTUuNCA1LjQgMCAwIDEgMC0zLjRWNUgxYTkgOSAwIDAgMCAwIDhsMy0yLjN6IiBmaWxsPSIjRkJCQzA1IiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48cGF0aCBkPSJNOSAzLjZjMS4zIDAgMi41LjQgMy40IDEuM0wxNSAyLjNBOSA5IDAgMCAwIDEgNWwzIDIuNGE1LjQgNS40IDAgMCAxIDUtMy43eiIgZmlsbD0iI0VBNDMzNSIgZmlsbC1ydWxlPSJub256ZXJvIi8+PHBhdGggZD0iTTAgMGgxOHYxOEgweiIvPjwvZz48L3N2Zz4=);
  background-color: white;
  background-repeat: no-repeat;
  background-position: 12px 15px;
  
  width: calc(100% - 0vw);
  
  &:hover {
    box-shadow: 0 -1px 0 rgba(0, 0, 0, .04), 0 2px 4px rgba(0, 0, 0, .25);
  }
  
  &:active {
    background-color: #eeeeee;
  }
  
  &:focus {
    outline: none;
    box-shadow: 
      0 -1px 0 rgba(0, 0, 0, .04),
      0 2px 4px rgba(0, 0, 0, .25),
      0 0 0 3px #c8dafc;
  }
  
  &:disabled {
    filter: grayscale(100%);
    background-color: #ebebeb;
    box-shadow: 0 -1px 0 rgba(0, 0, 0, .04), 0 1px 1px rgba(0, 0, 0, .25);
    cursor: not-allowed;
  }
}



 </style>


    <div id="appCapsule" class="pt-0">


        <div class="login-form mt-1">
            <div class="section">
                <img style="max-width: 30% !important;" src="assets/login.png" alt="image" class="form-image mt-1">
            </div>
            <div class="section mt-1">
                <h1 style="color: white; font-family: myFirstFont; font-size: 40px !important;">Hayatının Aşkını</h1>
                <h4 style="color: white; font-family: myFirstFont; font-size: 20px !important;">Bulmaya Hazır mısın?</h4>
            </div>
            <div class="section mt-1 mb-5">
                <form action="app-pages.html">
                    <div class="form-group boxed">
                        <div class="input-wrapper">
                            <input type="email" class="form-control" id="email1" placeholder="Eposta Adresi">
                            <input id="onesignal" type="hidden" value="<?=$user_onesignal?>">
                            <i class="clear-input">
                                <i class="fa-solid fa-circle-xmark"></i>
                            </i>
                        </div>
                    </div>

                    <div class="form-group boxed">
                        <div class="input-wrapper">
                            <input type="password" class="form-control" id="password1" placeholder="Şifre">
                            <i class="clear-input">
                                <i class="fa-solid fa-circle-xmark"></i>
                            </i>
                        </div>
                    </div>

                    <div class="form-links mt-2">
                        <div>
                            <a style='display:none;' href="register.php">Üyeliğim Yok - Kaydol</a>
                        </div>
                        <div><a href="javascript:void(0)" onclick="alert('yakında');" class="text-muted" style="color: white !important; text-decoration: none; background-color: transparent;">Şifremi Unuttum?</a></div>
                    </div>

                    <br />
                        <button type="button" id="gonder" onclick="girisYap();" class="btn btn-primary btn-block btn-lg" style="font-family: myFirstFont;">Giriş Yap</button>
                        <br /><br />
                        <a href="register.php" class="btn btn-warning btn-block btn-lg" style="font-family: myFirstFont;">Üyeliğin Yoksa Dokun ve Kaydol</a>
                    <br /><br />
					<p><button onclick="goTetikle();" type="button" class="login-with-google-btn" >
  Google Hesabı ile Hızlı Giriş Yap
</button></p> 

                 

                </form>
<br /><!-- 
<p>Package Name: <a href="https://play.google.com/store/apps/details?id=com.heysen.sevgilibul" style="color: white !important; text-decoration: none; background-color: transparent;">com.heysen.sevgilibul</a></p>

<p>Domain: <a href="https://app.heysen.net" style="color: white !important; text-decoration: none; background-color: transparent;">https://app.heysen.net</a></p>

<p>HeySen Official App</p> -->
            </div>
        </div>

    </div> 

    <!-- * App Capsule -->


<?php include 'footer.php'; ?>