Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private lateinit var mAuth:FirebaseAuth
- private lateinit var mAuthListener:FirebaseAuth.AuthStateListener
- class LoginActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_login)
- val goto=Intent(this,book_slot::class.java)
- val admin=loginName.toString()
- val admin_pass=loginPassword.toString()
- registerButton.setOnClickListener{
- startActivity(Intent(this,register_page::class.java))
- }
- signInButton.setOnClickListener {
- mAuth.signInWithEmailAndPassword(admin,admin_pass).addOnCompleteListener(this) { task ->
- if(task.isSuccessful) {
- val user= mAuth.currentUser
- Toast.makeText(this,"$user",Toast.LENGTH_LONG).show()
- startActivity(goto)
- } else {
- Toast.makeText(this,"Login error",Toast.LENGTH_LONG).show()
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment