ионная проверка подлинности otp, не признающая otp - PullRequest
0 голосов
/ 24 сентября 2019

отп не идентифицирует.otp отображается как недействительные учетные данные.Я использую ionic alertcontroller для получения OTP.бэкэнд не идентифицирует otp.он отображается как неопределенный в бэкэнде и ответе об ошибке.Как решить это.Есть ли способ использовать привязку ngModel в контроллере оповещений.

html

<div class="floating-label">
    <input placeholder="Email" type="email" id="email" name="Email" [(ngModel)]="Email">
    <label for="email">Email</label>
    <div class="floating-label">
        <input placeholder="Mobile" type="Mobile" id="mobileno" name="Mobile" [(ngModel)]="Mobile">
        <label for="email">Mobile</label>
        <div class="btn-sec">
            <button type="submit" (click)="Continue(Mobile,Email)">Continue</button>
        </div>
    </div>
</div>

.ts

    async Continue(Mobile, Email) {

        const user = {
            Mobile: Mobile,
            Email: Email,
        }
        console.log(Mobile);
        console.log(Email);
        this.api.SignupUser(user).subscribe(data => {
            console.log(data);
        });
        this.alert1 = await 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: 'ConfirmOTP',
                        handler: () => {
                            var user1 = {
                                Mobile: this.Mobile,
                                Email: this.Email,
                                otp: this.otp
                            };
                            console.log(user1);
                            this.api.Verifyotp(user1).subscribe(data => {
                                console.log(data);
                                this.data = data;
                                if (this.data.Msg) {
                                    alert(this.data.Msg);
                                } else {
                                    this.router.navigate(['/']);
                                }

                            });
                        }
                    ]
                }); this.alert1.present();
        };

service.ts

SignupUser(user): Observable <Object> {
    console.log(user);

    console.log('getting the signup data from user');
    return this.http.post < Object > (`${this.base_url}/signup`, user);

}
Verifyotp(user): Observable <Object> {
    console.log(user);
    console.log('getting all Listing from the server');
    return this.http.post < Object > (`${this.base_url}/verifysignupotp`, user);
}
...