我已使用带有隐形密码的Ionic 5应用程序(带有角度)设置了电话身份验证。
HTML文件
<div>
<ion-label>
Enter 10 digit phone number:
</ion-label>
<ion-input [(ngModel)]="phoneNumber" placeholder="9123456780" required minLength="10" maxlength="10"></ion-input>
<ion-button (click)="getPhoneCode()" id="sign-in-button">Get code</ion-button>
</div>
组件:
ngOnInit() {
if (!this.recaptchaSet) {
(<any>window).recaptchaVerifier = new firebase.auth.RecaptchaVerifier('sign-in-button', {
'size': 'invisible',
'callback': function (response) {
console.log('Sign in button callback');
this.getPhoneCode();
}
});
this.recaptchaSet = true;
}
}
getPhoneCode() {
if(!this.phoneNumber) {
return;
};
const phoneCode = "+1";
const phoneNumber = phoneCode + this.phoneNumber.toString();
const appVerifier = (<any>window).recaptchaVerifier;
firebase.auth().signInWithPhoneNumber(phoneNumber, appVerifier)
.then(result => {
console.log('Sign in with phone succeeded');
this.authService.setConfirmationResult(result);
this.router.navigateByUrl('auth/phoneCodeValidate');
}).catch(err => {
console.log('Error in code sending:', err)
});
}
这正常,除了单击“获取代码”按钮时,它会更改为其他内容:
之前:
点击后:
点击更改的链接/图标,将转到https://policies.google.com/terms?hl=en
您知道为什么按钮会被服务条款所取代以及如何避免这种情况吗?