Skip to content

Commit

Permalink
Update UserController.php
Browse files Browse the repository at this point in the history
  • Loading branch information
hscstudio authored Nov 24, 2016
1 parent a40c0fe commit 955af63
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,13 @@ public function actionUpdate($id)

if ($model->load(Yii::$app->request->post()) && $model->save()) {
if (!empty($model->new_password)) {
if ($model->validatePassword($model->new_password)) {
$model->setPassword($model->new_password);
}
$model->setPassword($model->new_password);
}
$model->status = $model->status==1?10:0;
if ($model->save()) {
Yii::$app->session->setFlash('success', 'User berhasil diupdate');
Yii::$app->session->setFlash('success', 'User berhasil diupdate');
} else {
Yii::$app->session->setFlash('error', 'User gagal diupdate');
Yii::$app->session->setFlash('error', 'User gagal diupdate');
}
return $this->redirect(['view', 'id' => $model->id]);
} else {
Expand Down Expand Up @@ -200,4 +198,4 @@ protected function findModel($id)
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}
}

0 comments on commit 955af63

Please sign in to comment.