<?php
    // Set up page title:
    $this->headTitle($this->translate('Create New Password'));

    // Set up breadcrumbs:
    $this->layout()->breadcrumbs = '<li><a href="' . $this->url('myresearch-home') . '">' . $this->transEsc('Your Account') . '</a></li>'
        . '<li class="active">' . $this->transEsc('Create New Password') . '</li>';
?>
<?php if ($this->auth()->isLoggedIn()): ?>
  <div class="<?=$this->layoutClass('mainbody')?>">
<?php endif; ?>

<h2><?=$this->transEsc('Create New Password') ?></h2>
<?=$this->flashmessages() ?>

<?php if (!$this->auth()->getManager()->supportsPasswordChange($this->auth_method)): ?>
  <div class="error"><?=$this->transEsc('recovery_new_disabled') ?></div>
<?php elseif (!isset($this->hash)): ?>
  <div class="error"><?=$this->transEsc('recovery_user_not_found') ?></div>
<?php else: ?>
  <form id="newpassword" class="form-new-password" action="<?=$this->url('myresearch-newpassword') ?>" method="post" data-toggle="validator" role="form">
    <input type="hidden" value="<?=$this->escapeHtmlAttr($this->auth()->getManager()->getCsrfHash(true))?>" name="csrf"/>
    <input type="hidden" value="<?=$this->escapeHtmlAttr($this->hash) ?>" name="hash"/>
    <input type="hidden" value="<?=$this->escapeHtmlAttr($this->username) ?>" name="username"/>
    <input type="hidden" value="<?=$this->escapeHtmlAttr($this->auth_method) ?>" name="auth_method"/>
    <?=$this->auth()->getNewPasswordForm() ?>
    <?=$this->recaptcha()->html($this->useRecaptcha) ?>
    <div class="form-group">
      <input class="btn btn-primary" name="submit" type="submit" value="<?=$this->transEsc('Submit')?>" />
    </div>
  </form>
<?php endif; ?>

<?php if ($this->auth()->isLoggedIn()): ?>
  </div>
  <div class="<?=$this->layoutClass('sidebar')?>">
    <?=$this->context($this)->renderInContext("myresearch/menu.phtml", ['active' => 'newpassword'])?>
  </div>
<?php endif; ?>
