Browse Source

Profil utilisateur : permettre édition adresse email #981

feature/souke
Guillaume Bourgeois 1 year ago
parent
commit
22066ed6e6
2 changed files with 1 additions and 5 deletions
  1. +0
    -4
      frontend/controllers/UserController.php
  2. +1
    -1
      frontend/views/user/update.php

+ 0
- 4
frontend/controllers/UserController.php View File

if ($model->load($this->getRequest()->post()) if ($model->load($this->getRequest()->post())
&& $model->validate()) { && $model->validate()) {


// l'utilisateur ne peut pas changer d'adresse email
$oldModel = $this->findModel($idUser);
$model->email = $oldModel->email;

// modification du mot de passe // modification du mot de passe
if (strlen($model->password_new)) { if (strlen($model->password_new)) {
$model->password_hash = \Yii::$app->security->generatePasswordHash($model->password_new); $model->password_hash = \Yii::$app->security->generatePasswordHash($model->password_new);

+ 1
- 1
frontend/views/user/update.php View File

<?= $form->field($model, 'lastname')->textInput() ?> <?= $form->field($model, 'lastname')->textInput() ?>
<?= $form->field($model, 'name')->textInput() ?> <?= $form->field($model, 'name')->textInput() ?>
<?= $form->field($model, 'phone')->textInput() ?> <?= $form->field($model, 'phone')->textInput() ?>
<?= $form->field($model, 'email')->textInput(['readonly' => true]); ?>
<?= $form->field($model, 'email')->textInput(); ?>
<?= $form->field($model, 'address')->textarea() ?> <?= $form->field($model, 'address')->textarea() ?>
<h2>Mot de passe</h2> <h2>Mot de passe</h2>

Loading…
Cancel
Save