Last active
February 22, 2019 10:53
-
-
Save rlarla245/f95b132e6e03bf42bf02e73015d1c582 to your computer and use it in GitHub Desktop.
Firebase Changing Password(비밀번호 변경)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Firebase 비밀번호 변경 | |
1. 비밀번호 변경을 담당할 버튼을 생성합니다. | |
2. dialog 창을 띄워 비밀번호 변경을 처리하도록 하는게 편리합니다. | |
예제 코드) | |
var editTextNewPassword = EditText(this) | |
// 별표처리 | |
editTextNewPassword.transformationMethod = PasswordTransformationMethod.getInstance() | |
var alertDialog = AlertDialog.Builder(this) | |
alertDialog.setTitle("") | |
alertDialog.setMessage("") | |
alertDialog.setView(editTextNewPassword) | |
alertDialog.setPositiveButton("변경", {dialogInterface, i -> changePasswrod(editTextNewPassword.text.toString())}) | |
alertDialog.setPositiveButton("변경", {dialogInterface, i -> dialogInterface.dismiss() }) | |
alertDialog.show() | |
// 비밀번호 바꿔주는 메소드 | |
fun changePassword(password:String) { | |
FirebaseAuth.getInstance().currentUser!!.updatePassword(password).addOnCompleteListener { | |
task -> | |
if (task.isSuccessful) { | |
Toast(...) | |
} else { | |
Toast(task.getException()) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment