From 04fd70fbfbc5e2f2aed1bcfe43b9f97452c552e6 Mon Sep 17 00:00:00 2001
From: Robert Lange <robert.lange@uni-leipzig.de>
Date: Wed, 28 Apr 2021 09:46:35 +0200
Subject: [PATCH] refs #19441 [finc, BARF] add template for change user
 password

* copied from /themes/bootstrap3/templates/Auth/AbstractBase/newpassword.phtml
* add autocomplete for change user password inputs
---
 .../Auth/AbstractBase/newpassword.phtml       | 46 +++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 themes/finc-accessibility/templates/Auth/AbstractBase/newpassword.phtml

diff --git a/themes/finc-accessibility/templates/Auth/AbstractBase/newpassword.phtml b/themes/finc-accessibility/templates/Auth/AbstractBase/newpassword.phtml
new file mode 100644
index 00000000000..a6715a36d31
--- /dev/null
+++ b/themes/finc-accessibility/templates/Auth/AbstractBase/newpassword.phtml
@@ -0,0 +1,46 @@
+<!-- finc-accessibility: Auth - AbstractBase - newpassword -->
+<?php /* copied /themes/bootstrap3/templates/Auth/AbstractBase/newpassword.phtml to add autocomplete */ ?>
+<?php if (isset($this->username)): ?>
+  <div class="form-group">
+    <label class="control-label"><?=$this->transEsc('Username') ?>:</label>
+    <p class="form-control-static"><?=$this->username ?></p>
+  </div>
+<?php endif; ?>
+<?php if (isset($this->verifyold) && $this->verifyold || isset($this->oldpwd)): ?>
+  <div class="form-group">
+    <label class="control-label"><?=$this->transEsc('old_password') ?>:</label>
+    <input id="current-password" type="password" name="oldpwd" class="form-control" autocomplete="current-password"/>
+    <div class="help-block with-errors"></div>
+  </div>
+<?php endif; ?>
+<?php
+  $pattern = '';
+  if (isset($this->passwordPolicy['pattern'])) {
+    if ($this->passwordPolicy['pattern'] == 'numeric') {
+      $pattern = '\d+';
+    } elseif ($this->passwordPolicy['pattern'] == 'alphanumeric') {
+      $pattern = '[\da-zA-Z]+';
+    } else {
+      $pattern = $this->passwordPolicy['pattern'];
+    }
+  }
+?>
+<div class="form-group">
+  <label class="control-label"><?=$this->transEsc('new_password') ?>:</label>
+  <input type="password" id="password" name="password" class="form-control" required aria-required="true"
+    <?=isset($this->passwordPolicy['minLength']) ? ' data-minlength="' . $this->passwordPolicy['minLength'] . '" data-minlength-error="' . $this->escapeHtmlAttr($this->translate('password_minimum_length', ['%%minlength%%' => $this->passwordPolicy['minLength']])) . '"' : ''  ?>
+    <?=isset($this->passwordPolicy['maxLength']) ? ' maxlength="' . $this->passwordPolicy['maxLength'] . '"' : '' ?>
+    <?=$pattern ? ' pattern="' . $pattern . '"' : '' ?>
+    autocomplete="new-password"
+  />
+  <?php if ($this->passwordPolicy['hint']): ?>
+    <div class="help-block"><?=$this->transEsc($this->passwordPolicy['hint']) ?></div>
+  <?php endif; ?>
+  <div class="help-block with-errors"></div>
+</div>
+<div class="form-group">
+  <label class="control-label"><?=$this->transEsc('confirm_new_password') ?>:</label>
+  <input type="password" name="password2" class="form-control" required aria-required="true" data-match="#password" data-match-error="<?=$this->escapeHtmlAttr($this->translate('Passwords do not match'))?>" autocomplete="new-password"/>
+  <div class="help-block with-errors"></div>
+</div>
+<!-- finc-accessibility: Auth - AbstractBase - newpassword - END -->
\ No newline at end of file
-- 
GitLab