2017-12-20 13 views
0

私のアプリは現在adminとuserの2種類のユーザーを持つionicアプリケーションで役割ベースのログインを行う方法。管理者のログイン時には管理者のページに移動し、ユーザーのログイン時には通常のユーザーのページに移動します。IONICの役割ベースのログイン認証

+0

ログインすると、ユーザータイプが表示されます。ユーザーのプッシュまたはセットルートページに従って。 this.navctrl.root(user)/ this.navctrl.root(admin) – Manish

+0

ありがとうマンシュールクマあなたはより明確にステップを説明してくださいできますか?私は自分のデータベースやコードだけを変更する必要がありますか? –

答えて

0
//I think you will get response after successful login, 
//In response you will also get userType which identify which type user. after that according to user setRoot page 
//setRoot page for not showing login page on back 

this.auth.validateUser().then((result) =>{ 
    if(result.status === 200){ 
    if(result.userType === "admin"){ 
     this.navCtrl.setRoot(adminPage); 
    } 
    if(result.userType === "user"){ 
     this.navCtrl.setRoot(userPage); 
    } 
    } 
}) 
+0

大変ありがとう、助けてくれてありがとう。この方法で試してみる:) –

関連する問題