<?php

use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm;

$this->title = Yii::t('app', 'Change Password');
$this->params['breadcrumbs'][] = $this->title;

?>

<div class="users-form middle-page-container">

    <h1><?= $this->title ?></h1>

    <?php $form = ActiveForm::begin(); ?>

    <?php if(Yii::$app->session->hasFlash('incorrect_old_password')): ?>
        <div class="alert alert-danger">
            <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
            <?= Yii::$app->session->getFlash('incorrect_old_password') ?>
        </div>
    <?php endif; ?>

    <?php if(Yii::$app->session->hasFlash('password_changed_successfully')): ?>
        <div class="alert alert-success">
            <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
            <?= Yii::$app->session->getFlash('password_changed_successfully') ?>
        </div>
    <?php endif; ?>

    <?= $form->field($model, 'old_password')->passwordInput(['maxlength' => true, 'value' => '']) ?>

    <?= $form->field($model, 'password')->passwordInput(['maxlength' => true, 'value' => ''])->label(Yii::t('app', 'New Password')) ?>

    <?= $form->field($model, 'confirm_password')->passwordInput(['maxlength' => true])->label(Yii::t('app', 'Confirm New Password')) ?>

    <div class="form-group">
        <?= Html::submitButton(Yii::t('app', 'Save'), ['class' => 'btn btn-success btn-expanded']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
