2017-12-18 16 views
-4

로그인 및 가입 버튼이 동일한 활동에있는 많은 로그인 샘플 (예 : Android Studio 로그인 활동, firebase 인증 빠른 시작 샘플)을 보았습니다. 같은 필드를 사용합니다. 그리고 가입 버튼을 클릭 할 때 위에서 입력 한 이메일과 비밀번호로 새 계정을 만들 수 있다는 것이 확실한 것인지 궁금합니다. 내 로그인 활동의 스크린 샷에 링크 https://i.stack.imgur.com/U7tBD.jpgAndroid에서 로그인하여 동일한 활동에 가입하십시오.

+0

, 이들 형태 중 하나의 버튼을 "등록"버튼을 클릭 이벤트 리스너에서이 메소드를 호출 할 것 추가 양식 입력 - 적어도 "암호 확인"단계로 이동하십시오. – ceejayoz

+0

다른 동사가있는 두 개의 버튼이있는 양식이 하나없는 나쁜 디자인입니다. 만약 로그인 버튼이 있다면 .... 등록되지 않았다는 하단의 텍스트 뷰? 여기에 등록하십시오. 클릭하면 새로운 활동/단편 – DroiDev

+0

으로 이동합니다. 가입 한 후 가입 페이지를 만드십시오 => 로그인 페이지로 이동 => 홈 페이지로 이동 –

답변

0

아니요, 명확하지 않습니다.

"가입"버튼을 클릭하면 새로운 화면으로 이동 (새 활동/조각 시작)하는 것이 좋습니다. 또한 가입시 비밀번호의 철자가 틀린 경우 (사용자가 로그인 할 수 없게 될 수 있음) 비밀번호 설정을위한 2 개의 입력란이있는 것이 좋습니다.

0

분명히하는 것이 좋습니다. 사용자가 실수로 등록 버튼을 클릭 할 때 사인하려고하면 오류가 발생합니다. 그러나 각 버튼에 대해 을 올바르게 구현하면 (로그인시 FirebaseAuth.getInstance().signInWithEmailAndPassword(email,password), 등록시 FirebaseAuth.getInstance().createUserWithEmailAndPassword(email,password)), 수행하려는 작업이 명확하게 표시됩니다.

0

로그인 방법

private void loginMethod() { 
    progressDialog(); // Show your progress dialog if you want to \\ 
    final String email = emailEt.getText().toString().trim(); 
    final String password = passwordEt.getText().toString().trim(); 
    //authenticate user 
    auth.signInWithEmailAndPassword(email, password) 
      .addOnCompleteListener(LoginActivity.this, new OnCompleteListener<AuthResult>() { 
       @Override 
       public void onComplete(@NonNull Task<AuthResult> task) { 
        // If sign in fails, display a message to the user. If sign in succeeds 
        // the auth state listener will be notified and logic to handle the 
        // signed in user can be handled in the listener. 
        if (!task.isSuccessful()) { 
         dismissDialog(); 
         // there was an error 
         if (password.length() < 6) { 
          passwordEt.setError(getString(R.string.err_minimum_password)); 
         } else { 
          Toast.makeText(LoginActivity.this, getString(R.string.err_auth_failed), 
            Toast.LENGTH_LONG).show(); 
         } 
        } else { 

          dismissDialog(); 
          // do your stuff here \\ 


        } 
       } 
      }); 
} 

가입 방법

private void signUpMethod() { 
    progressDialog(); 
    final String email = emailEt.getText().toString().trim(); 
    String password = passwordEt.getText().toString().trim(); 
    //create user 
    auth.createUserWithEmailAndPassword(email, password) 
      .addOnCompleteListener(SignUpActivity.this, new OnCompleteListener<AuthResult>() { 
       @Override 
       public void onComplete(@NonNull Task<AuthResult> task) { 

        // If sign in fails, display a message to the user. If sign in succeeds 
        // the auth state listener will be notified and logic to handle the 
        // signed in user can be handled in the listener. 

        if (!task.isSuccessful()) { 

         dismissDialog(); 

        } else { 

         // do your stuff here \\ 

        } 
       } 
      }); 
} 

그냥 내 경험에