1<?php 2 3namespace dokuwiki\plugin\config\core\Setting; 4 5/** 6 * Class setting_password 7 */ 8class SettingPassword extends SettingString 9{ 10 11 protected $code = 'plain'; // mechanism to be used to obscure passwords 12 13 /** @inheritdoc */ 14 public function update($input) { 15 if($this->isProtected()) return false; 16 if(!$input) return false; 17 18 if($this->pattern && !preg_match($this->pattern, $input)) { 19 $this->error = true; 20 $this->input = $input; 21 return false; 22 } 23 24 $this->local = conf_encodeString($input, $this->code); 25 return true; 26 } 27 28 /** @inheritdoc */ 29 public function html(\admin_plugin_config $plugin, $echo = false) { 30 31 $disable = $this->isProtected() ? 'disabled="disabled"' : ''; 32 33 $key = htmlspecialchars($this->key); 34 35 $label = '<label for="config___' . $key . '">' . $this->prompt($plugin) . '</label>'; 36 $input = '<input id="config___' . $key . '" name="config[' . $key . 37 ']" autocomplete="off" type="password" class="edit" value="" ' . $disable . ' />'; 38 return [$label, $input]; 39 } 40} 41