Skip to content

Commit

Permalink
fix/#5:공백 로그인 성공 오류 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
hyeeum committed Apr 13, 2024
1 parent 40c4f30 commit f6a8a70
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions app/src/main/java/com/sopt/now/LoginActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class LoginActivity : AppCompatActivity() {
}
}
binding.btnLogin.setOnClickListener {
startMainActivity()
sendData(id,pw,nick)
}
}
Expand All @@ -53,6 +52,7 @@ class LoginActivity : AppCompatActivity() {
val userId = binding.etvLoginId.text.toString()
val userPw = binding.etvLoginPw.text.toString()
val message = when{
userId == "" || userPw == "" -> "모든 항목을 입력해주세요."
userId != id || userPw != pw -> "아이디 혹은 비밀번호가 일치하지 않습니다."
else -> {
loginBool = true
Expand All @@ -62,18 +62,16 @@ class LoginActivity : AppCompatActivity() {
Toast.makeText(this,message,Toast.LENGTH_SHORT).show()
return loginBool
}
private fun startMainActivity(){
val intent = Intent(this, MainActivity::class.java)
startActivity(intent)
}
private fun sendData(id:String,pw:String,nick:String){
if (isLoginAvailable(id, pw)) {
val intent = Intent(this, MainActivity::class.java)
val mypagefragment = MyPageFragment()
val bundle = Bundle()
bundle.putString("id",id)
bundle.putString("pw",pw)
bundle.putString("nick",nick)
mypagefragment.arguments = bundle
startActivity(intent)
}
}
}

0 comments on commit f6a8a70

Please sign in to comment.