Skip to content

Instantly share code, notes, and snippets.

@rlarla245
Last active February 22, 2019 10:53
Show Gist options
  • Save rlarla245/f95b132e6e03bf42bf02e73015d1c582 to your computer and use it in GitHub Desktop.
Save rlarla245/f95b132e6e03bf42bf02e73015d1c582 to your computer and use it in GitHub Desktop.
Firebase Changing Password(비밀번호 변경)
- 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