示例#1
0
 public function actionLogin()
 {
     $Model = new Masuser();
     $request = \Yii::$app->request;
     $username = $request->post('username');
     $passwordInput = $request->post('password');
     $Auth = $Model->Auth($username);
     if (!empty($Auth)) {
         if ($Auth['password'] == $passwordInput) {
             \Yii::$app->session['username'] = $username;
             \Yii::$app->session['userId'] = $Auth['id'];
             \Yii::$app->session['user'] = true;
             //Set Privilege In Session
             $Privilege = new Privilege();
             $Privilege->getPrivilege($Auth['id']);
             $flag = "1";
         } else {
             $flag = "0";
         }
     } else {
         $flag = "0";
     }
 }