<?php

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

$this->title = Yii::t('app', 'Reset Password');

?>

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

    <div id="login-form-image" class="middle-page-container">
        <?= Html::img(Url::to('@web/images/logo-train.png'), ['alt' => 'login-img', 'class' => 'img-responsive']) ?>
    </div>

    <?php if($model == null): ?>

        <?php if(Yii::$app->session->hasFlash('invalid_token')): ?>
            <div class="alert alert-danger">
                <?= Yii::$app->session->getFlash('invalid_token') ?>
                <br>
                <?= Html::a(Yii::t('app', 'Re-forgot password'), ['forgot-password']) ?>
            </div>
        <?php endif; ?>
        
    <?php else: ?>

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

        <h5><?= Yii::t('app', 'Write down new password') ?></h5>

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

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

        <div class="form-group middle-page-container text-align-center">
            <?= Html::submitButton(Yii::t('app', 'Save'), ['class' => 'btn btn-success']) ?>
        </div>

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

</div>
