일부 매개 변수를 가져와 firebase에서 암호 기능을 재설정하려고합니다. 내가 mode
, oobCode
및 apiKey
을 얻고 싶은 http://localhost:8080/passwordreset?mode=resetPassword&oobCode=y6FIOAtRUKYf88Rt5OlEwxUuTyEmb3M4gquZSIseX2UAAAFevpj-gw&apiKey=AIzaSyBaCCvq-ZEfQmdrL7fmElXDjZF_J-tku2I매개 변수를 가져 와서 내 메서드에서 사용할 변수에 저장하고 사용하십시오.
:처럼 내 링크의 모양을
이입니다. 중포 기지 문서에서
export default {
data: function() {
return {
passwordNew: '',
passwordConfirm: '',
mode:'',
actionCode: '',
continueUrl: '',
}
},
methods: {
handleResetPassword: function() {
var accountEmail;
firebase.auth().verifyPasswordResetCode(actionCode).then(function(email) {
var accountEmail = email;
firebase.auth().confirmPasswordReset(this.actionCode, this.passwordNew).then(function(resp) {
alert("Password reset success");
this.$router.push('hello')
}).catch(function(error) {
// Error occurred during confirmation. The code might have expired or the
// password is too weak.
console.log("error 1")
});
}).catch(function(error) {
// Invalid or expired action code. Ask user to try to reset the password
// again.
console.log("error 2")
});
},
}
}
가능한 복제 [? 콜백 내에서 올바른 \ '이 \를'에 액세스하는 방법 (https://stackoverflow.com/questions/20279484/how-to : 내보내기 기본에서
-access-the-correct-this-inside-a-callback) – Bert
@Bert에게 도움을 주셔서 감사합니다. 그러나 이것이 중복이라고 생각하지 않습니다. – Muli
적어도 부분적으로는 위의 코드 중 아무 것도 작동하지 않습니다. 'then' 콜백에서'function() {}'을 사용하기 때문에 데이터 프로퍼티에 접근 할 수 없습니다. 화살표 함수, 클로저 또는 바인딩을 사용해야합니다. – Bert