ionic应用程序登录问题。没有otp的登录无法正常工作。打开otp弹出窗口

时间:2019-09-22 07:38:37

标签: angular typescript ionic-framework ionic4 ionic-popup

我有一个离子应用程序的登录部分,其中包括两个部分, 1.使用otp代替密码登录 2.使用密码登录。 这些应显示在复选框中。 当我选中该复选框时,密码输入字段将隐藏并单击登录,Otp弹出窗口将打开,它可以正常工作。我的问题是,当我使用密码选项时,弹出窗口仍在我的手机中并出现了otp。使用电子邮件和密码登录无法正常工作。

HTML

<div class="floating-label">
<input  type="email" placeholder="Email or Mobile" [(ngModel)]="EmailorMobile" name="EmailorMobile" id="EmailorMobile" autocomplete="off" >
<label for="email">Email or Mobile</label>
<div class="floating-label" *ngIf="!checked">
<input type="password" name="Password" [(ngModel)]="Password" placeholder="Password" id="password" autocomplete="off" required="true">
<label for="password">Password</label>
<div class="btn-sec">
<div class="checkbox login-checkbox">
<input id="Checkbox3" name="checked" type="checkbox"  [(ngModel)]="checked" />
<label for="Checkbox3">login with OTP instead of password</label>
 </div>

 </div>
 <div class="btn-sec">
 <ion-button type="submit" (click)="Login()">Login</ion-button>
 <span class=""><a href="forgot-password.html">forgot password</a></span>
 </div>

.TS

Login() {
const user= {

EmailorMobile:this.EmailorMobile,
Password:this.Password 

}

this.apiService.loginUser(user).subscribe(data=>{
console.log(data); 
});
this.alertCtrl.create({
header: 'OTP',
message: 'Please Enter your Otp sent to your Mobile Number',

inputs: [{
name: 'OTP',
value:'OTP',
}],
buttons: [{
text: 'Cancel',
role: 'cancel'
},
{
text: 'Yes',
handler: () => {

this.apiService.loginUser(user).subscribe(data=>{
console.log(data); 
});
}

}
]
}).then(alertPresent => {
alertPresent.present();
});
}
[Login[\]\[1\]][1]}

0 个答案:

没有答案