Skip to content

Instantly share code, notes, and snippets.

@fatihhcan
Created July 25, 2020 13:16
Show Gist options
  • Save fatihhcan/36bdb77bb521c17076eece3455dc7870 to your computer and use it in GitHub Desktop.
Save fatihhcan/36bdb77bb521c17076eece3455dc7870 to your computer and use it in GitHub Desktop.
btn_Giris.setOnClickListener {
if (et_Mail.text.isNotEmpty() && et_Sifre.text.isNotEmpty()){
progressBarGoster()
// Firebase kütüphanesinden email ve password parametrelerine tanımladığımız edit textleri Stringe çeviriyoruz.
FirebaseAuth.getInstance().signInWithEmailAndPassword(et_Mail.text.toString(),et_Sifre.text.toString())
.addOnCompleteListener(object:OnCompleteListener<AuthResult>{
// Kullanıcı başarılı giriş yaptığında bildirim oluşturuyoruz.
override fun onComplete(p0: Task<AuthResult>) {
if(p0.isSuccessful){
progressBarGizle()
// Toast.makeText(this@LoginActivity,"Başarılı Giriş: "+FirebaseAuth.getInstance().currentUser?.email, Toast.LENGTH_SHORT).show()
FirebaseAuth.getInstance().signOut()
}else{
// Kullanıcı hatalı giriş yaptığında bildirim oluşturuyoruz.
progressBarGizle()
Toast.makeText(this@LoginActivity,"Hatalı Giriş: "+p0.exception?.message, Toast.LENGTH_SHORT).show()
}
}
})
}else{
// Kullanıcı alanı boş bıraktığında bildirim oluşturuyoruz.
Toast.makeText(this@LoginActivity,"Boş alanları doldurunuz", Toast.LENGTH_SHORT).show()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment