2017-12-20 9 views
0

내 앱에 현재 admin과 user라는 두 가지 유형의 사용자가있는 ionic 앱에서 역할 기반 로그인을 수행하는 방법. 관리자 로그인시 관리자 페이지로 이동하고, 사용자 로그인시 일반 사용자 페이지로 이동합니다.IONIC의 역할 기반 로그인 인증

+0

로그인하면 사용자 유형이 표시됩니다. 사용자 푸시 또는 루트 페이지 설정에 따라 this.navctrl.root (user)/this.navctrl.root (admin) – Manish

+0

감사합니다 manish kumar 좀 더 명확하게 설명해주십시오. 내 데이터베이스 또는 코드를 수정해야합니까? –

답변

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

대단히 맘에 든 고맙습니다. 이 방법을 시도합니다 :) –