- Allow setting autocomplete attribute for all inputs separately (#1487313)

release-0.6
alecpl 14 years ago
parent 53604a0550
commit 1cca4fbd45

@ -7,6 +7,7 @@ CHANGELOG Roundcube Webmail
- Fix window is blur'ed in IE when selecting a message (#1487316) - Fix window is blur'ed in IE when selecting a message (#1487316)
- Fix cursor position on compose form in Webkit browsers (#1486674) - Fix cursor position on compose form in Webkit browsers (#1486674)
- Fix setting charset of attachment filenames (#1487122) - Fix setting charset of attachment filenames (#1487122)
- Allow setting autocomplete attribute for all inputs separately (#1487313)
RELEASE 0.5-BETA RELEASE 0.5-BETA
---------------- ----------------

@ -180,8 +180,9 @@ $rcmail_config['message_cache_lifetime'] = '10d';
// set the port for the ssl connection as value of this option if it differs from the default 443 // set the port for the ssl connection as value of this option if it differs from the default 443
$rcmail_config['force_https'] = false; $rcmail_config['force_https'] = false;
// Allow browser-autocompletion on login form // Allow browser-autocompletion on login form.
$rcmail_config['login_autocomplete'] = false; // 0 - disabled, 1 - username and host only, 2 - username, host, password
$rcmail_config['login_autocomplete'] = 0;
// If users authentication is not case sensitive this must be enabled. // If users authentication is not case sensitive this must be enabled.
// You can also use it to force conversion of logins to lower case. // You can also use it to force conversion of logins to lower case.

@ -1045,7 +1045,7 @@ class rcube_template extends rcube_html_page
private function login_form($attrib) private function login_form($attrib)
{ {
$default_host = $this->config['default_host']; $default_host = $this->config['default_host'];
$attrib['autocomplete'] = $this->config['login_autocomplete'] ? null : 'off'; $autocomplete = (int) $this->config['login_autocomplete'];
$_SESSION['temp'] = true; $_SESSION['temp'] = true;
@ -1054,11 +1054,18 @@ class rcube_template extends rcube_html_page
if (empty($url) && !preg_match('/_(task|action)=logout/', $_SERVER['QUERY_STRING'])) if (empty($url) && !preg_match('/_(task|action)=logout/', $_SERVER['QUERY_STRING']))
$url = $_SERVER['QUERY_STRING']; $url = $_SERVER['QUERY_STRING'];
$input_user = new html_inputfield(array('name' => '_user', 'id' => 'rcmloginuser') + $attrib); // set atocomplete attribute
$input_pass = new html_passwordfield(array('name' => '_pass', 'id' => 'rcmloginpwd') + $attrib); $user_attrib = $autocomplete > 0 ? array() : array('autocomplete' => 'off');
$host_attrib = $autocomplete > 0 ? array() : array('autocomplete' => 'off');
$pass_attrib = $autocomplete > 1 ? array() : array('autocomplete' => 'off');
$input_action = new html_hiddenfield(array('name' => '_action', 'value' => 'login')); $input_action = new html_hiddenfield(array('name' => '_action', 'value' => 'login'));
$input_tzone = new html_hiddenfield(array('name' => '_timezone', 'id' => 'rcmlogintz', 'value' => '_default_')); $input_tzone = new html_hiddenfield(array('name' => '_timezone', 'id' => 'rcmlogintz', 'value' => '_default_'));
$input_url = new html_hiddenfield(array('name' => '_url', 'id' => 'rcmloginurl', 'value' => $url)); $input_url = new html_hiddenfield(array('name' => '_url', 'id' => 'rcmloginurl', 'value' => $url));
$input_user = new html_inputfield(array('name' => '_user', 'id' => 'rcmloginuser')
+ $attrib + $user_attrib);
$input_pass = new html_passwordfield(array('name' => '_pass', 'id' => 'rcmloginpwd')
+ $attrib + $pass_attrib);
$input_host = null; $input_host = null;
if (is_array($default_host) && count($default_host) > 1) { if (is_array($default_host) && count($default_host) > 1) {
@ -1080,7 +1087,8 @@ class rcube_template extends rcube_html_page
'name' => '_host', 'id' => 'rcmloginhost', 'value' => $host) + $attrib); 'name' => '_host', 'id' => 'rcmloginhost', 'value' => $host) + $attrib);
} }
else if (empty($default_host)) { else if (empty($default_host)) {
$input_host = new html_inputfield(array('name' => '_host', 'id' => 'rcmloginhost') + $attrib); $input_host = new html_inputfield(array('name' => '_host', 'id' => 'rcmloginhost')
+ $attrib + $host_attrib);
} }
$form_name = !empty($attrib['form']) ? $attrib['form'] : 'form'; $form_name = !empty($attrib['form']) ? $attrib['form'] : 'form';

Loading…
Cancel
Save