Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70440

Help understanding login logic in ionic 4 + angular

$
0
0

I’ve got an app that redirects users depending if they are logged in or not. It’s displaying some odd behaviour, which i’mt rying to get to the bottom of. I don’t understand the logic of this code - i am an angular newbie so it might be simple. why are there + signs in the paths, and why does it look like both times it goes to the same place. I’ve tried googling, but i’m not getting anywhere. if anyone can point me in the right direction please

  firebase.auth().onAuthStateChanged((user) => {
        console.log(user)
        if (!user) {
            return;
        }

        let providerInfo = JSON.stringify(firebase.auth().currentUser.providerData[0].providerId);

        if (Login.emailVerification && providerInfo == '"password"') {
            if (user['emailVerified']) {
                //Goto Home Page.
                this.zone.run(() => {
                    console.log("asdfsdf")
                    this.router.navigate(['/' + Login.homePage + '/' + Login.homePage + '/timeline']);

                    console.log("Go to Tabs Page")
                });
            }
            else {
                this.router.navigate(['/' + Login.verificationPage]);
            }
        }
        else {
            //Goto Home Page.
            this.zone.run(() => {
                this.router.navigate(['/' + Login.homePage + '/' + Login.homePage + '/timeline']);
                console.log("Go to Tabs Page")
            });
            //Since we're using a TabsPage an NgZone is required.
        }
    });

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 70440

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>