Guest User

Untitled

a guest
Sep 27th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. private lateinit var mAuth:FirebaseAuth
  2. private lateinit var mAuthListener:FirebaseAuth.AuthStateListener
  3.  
  4.  
  5. class LoginActivity : AppCompatActivity() {
  6.  
  7. override fun onCreate(savedInstanceState: Bundle?) {
  8. super.onCreate(savedInstanceState)
  9. setContentView(R.layout.activity_login)
  10. val goto=Intent(this,book_slot::class.java)
  11.  
  12. val admin=loginName.toString()
  13. val admin_pass=loginPassword.toString()
  14. registerButton.setOnClickListener{
  15. startActivity(Intent(this,register_page::class.java))
  16. }
  17.  
  18. signInButton.setOnClickListener {
  19. mAuth.signInWithEmailAndPassword(admin,admin_pass).addOnCompleteListener(this) { task ->
  20. if(task.isSuccessful) {
  21. val user= mAuth.currentUser
  22. Toast.makeText(this,"$user",Toast.LENGTH_LONG).show()
  23. startActivity(goto)
  24. } else {
  25. Toast.makeText(this,"Login error",Toast.LENGTH_LONG).show()
  26. }
  27. }
  28. }
  29. }
Add Comment
Please, Sign In to add comment