public function actionRemove($id)
 {
     $model = new Users();
     $isSystem = $model::find()->where(['id' => $id])->asArray()->one();
     if ($isSystem["system"] == 0) {
         $user = $model->findOne($id);
         $user->delete();
         app::I()->RemoveFiles("/protected/frontend/assets/images/users/{$id}", 1);
     }
     $this->redirect(Url::toRoute('/users/catalog'));
 }
Ejemplo n.º 2
0
 public function actionLogin()
 {
     if (yii::$app->request->isPost) {
         $data = yii::$app->request->post();
         $model = new Users();
         $user = $model->findOne(['username' => $data['login']]);
         if (password_verify($data["password"], $user->password)) {
             $login = yii::$app->user->login($user);
             if ($login) {
                 $this->redirect(['/index/index']);
             }
         } else {
             return $this->render('index', $data);
         }
     }
 }