disable password saving

This commit is contained in:
Roland Gruber 2019-10-10 20:45:40 +02:00
parent ff8fd47bed
commit b5e163cfc3
4 changed files with 20 additions and 11 deletions

View File

@ -448,6 +448,8 @@ class htmlInputField extends htmlElement {
protected $isPassword = false;
/** check password strength */
protected $checkPasswordStrength = false;
/** disables browser autofilling of password fields */
protected $disableAutoFill = false;
/** enabled or disabled */
protected $isEnabled = true;
/** indicates that the value should be saved in obfuscated form */
@ -591,11 +593,16 @@ class htmlInputField extends htmlElement {
if (!empty($this->title)) {
$title = ' title="' . $this->title . '"';
}
$autoCompleteVal = '';
if ($this->disableAutoFill) {
$autoCompleteVal = ' autocomplete="new-password"';
}
if ($this->showDnSelection) {
echo '<span class="nowrap">';
}
echo '<input type="' . $inputType . '"' . $class . $name . $id . $value . $maxLength
. $min . $max . $size . $fieldTabIndex . $onKeyPress . $onKeyUp . $title . $disabled . '>';
. $min . $max . $size . $fieldTabIndex . $onKeyPress . $onKeyUp . $title . $disabled
. $autoCompleteVal . '>';
if ($this->showDnSelection) {
echo '<img class="align-middle" src="../../graphics/view.png"
width="16" height="16" title="' . _('Choose entry') . '"
@ -706,10 +713,12 @@ class htmlInputField extends htmlElement {
*
* @param boolean $isPassword password field
* @param boolean $checkStrength check if matches password policy (default: false)
* @param boolean $disableAutoFill prevent autofilling by browser
*/
public function setIsPassword($isPassword, $checkStrength = false) {
public function setIsPassword($isPassword, $checkStrength = false, $disableAutoFill = false) {
$this->isPassword = $isPassword;
$this->checkPasswordStrength = $checkStrength;
$this->disableAutoFill = $disableAutoFill;
}
/**

View File

@ -177,8 +177,8 @@ printConfigurationPageTabs(ConfigurationPageTab::GENERAL);
?>
<input type="text" name="hiddenPreventAutocomplete" autocomplete="false" class="hidden" value="">
<input type="password" name="hiddenPreventAutocompletePwd1" autocomplete="false" class="hidden" value="">
<input type="password" name="hiddenPreventAutocompletePwd2" autocomplete="false" class="hidden" value="">
<input type="password" name="hiddenPreventAutocompletePwd1" autocomplete="false" class="hidden" value="123">
<input type="password" name="hiddenPreventAutocompletePwd2" autocomplete="false" class="hidden" value="321">
<?php
$row = new htmlResponsiveRow();
@ -503,9 +503,9 @@ if (extension_loaded('curl')) {
// new password
$row->add(new htmlSubTitle(_("Profile password"), '../../graphics/keyBig.png', null, true), 12);
$password1 = new htmlResponsiveInputField(_("New password"), 'passwd1', null, '212');
$password1->setIsPassword(true);
$password1->setIsPassword(true, false, true);
$password2 = new htmlResponsiveInputField(_("Reenter password"), 'passwd2');
$password2->setIsPassword(true);
$password2->setIsPassword(true, false, true);
$password2->setSameValueFieldID('passwd1');
$row->add($password1, 12);
$row->add($password2, 12);

View File

@ -479,10 +479,10 @@ $row->addVerticalSpacer('3rem');
// change master password
$row->add(new htmlSubTitle(_("Change master password")), 12);
$pwd1 = new htmlResponsiveInputField(_("New master password"), 'masterpassword', '', '235');
$pwd1->setIsPassword(true);
$pwd1->setIsPassword(true, false, true);
$row->add($pwd1, 12);
$pwd2 = new htmlResponsiveInputField(_("Reenter password"), 'masterpassword2', '');
$pwd2->setIsPassword(true);
$pwd2->setIsPassword(true, false, true);
$pwd2->setSameValueFieldID('masterpassword');
$row->add($pwd2, 12);
$row->addVerticalSpacer('3rem');

View File

@ -9,7 +9,7 @@ use \htmlSubTitle;
/*
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2009 - 2018 Roland Gruber
Copyright (C) 2009 - 2019 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -121,8 +121,8 @@ printConfigurationPageTabs(ConfigurationPageTab::MODULE_SETTINGS);
?>
<input type="text" name="hiddenPreventAutocomplete" autocomplete="false" class="hidden" value="">
<input type="password" name="hiddenPreventAutocompletePwd1" autocomplete="false" class="hidden" value="">
<input type="password" name="hiddenPreventAutocompletePwd2" autocomplete="false" class="hidden" value="">
<input type="password" name="hiddenPreventAutocompletePwd1" autocomplete="false" class="hidden" value="123">
<input type="password" name="hiddenPreventAutocompletePwd2" autocomplete="false" class="hidden" value="321">
<?php