backend/modules/api/controllers/AuthController.php
/**
    * Admin Login logic
    * @return Array with status and User Identity object
    */
Admin Login logic
@return Array with status and User Identity object
Admin Login logic @return Array with status and User Identity object
public function actionAdminlogin(){
        $email = Yii::$app->request->post('email');
        $password = Yii::$app->request->post('password');
        $user = User::find()->where(['email' => $email])->one();
        if ($user != null && $user->validatePassword($password)) {
            if ($user->hasRole('admin')) {
                $isLoggedIn = Yii::$app->user->login($user);
                return [
                    'status' => 'success',
                    'login' => $isLoggedIn
                ];
            }
        }
        $error = 'Incorrect Email or Password';
        return [
            'status' => 'error',
            'message' => $error,
            'login' => Yii::$app->user->isGuest
        ];
    }
public function actionAdminlogin ( ) { $ email = Yii :: $ app -> request -> post ( 'email' ) ; $ password = Yii :: $ app -> request -> post ( 'password' ) ; $ user = User :: find ( ) -> where ( [ 'email' => $ email ] ) -> one ( ) ; if ( $ user != null && $ user -> validatePassword ( $ password ) ) { if ( $ user -> hasRole ( 'admin' ) ) { $ isLoggedIn = Yii :: $ app -> user -> login ( $ user ) ; return [ 'status' => 'success' , 'login' => $ isLoggedIn ] ; } } $ error = 'Incorrect Email or Password' ; return [ 'status' => 'error' , 'message' => $ error , 'login' => Yii :: $ app -> user -> isGuest ] ; }
Admin Login logic
 @return Array with status and User Identity object
Admin Login logic @return Array with status and User Identity object