change password

This commit is contained in:
akosse
2020-01-22 12:18:03 +03:00
parent cb10af1bce
commit 8322d58066
8 changed files with 78 additions and 12 deletions

View File

@ -3,8 +3,10 @@
namespace frontend\modules\card\controllers;
use common\classes\Debug;
use common\models\CardSkill;
use common\models\FieldsValueNew;
use common\models\User;
use Yii;
use frontend\modules\card\models\UserCard;
use yii\data\ActiveDataProvider;
@ -57,7 +59,6 @@ class UserCardController extends Controller
]);
$skills = CardSkill::find()->where(['card_id' => $id])->with('skill')->all();
return $this->render('view', [
'model' => $this->findModel($id),
'modelFildValue' => $dataProvider,
@ -86,6 +87,28 @@ class UserCardController extends Controller
]);
}
public function actionPassword($id)
{
$user_card = UserCard::findOne($id);
$model = User::findOne(['id' => $user_card->id_user]);
return $this->render('password', [
'model' => $model,
]);
}
public function actionAjax() {
if(Yii::$app->request->isAjax) {
$id = $_POST['id'];
$password = $_POST['password'];
$user_card = UserCard::findOne($id);
$user = User::findOne(['id' => $user_card->id_user]);
$user->password = $password;
$user->save();
}
}
/**
* Finds the Product model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.