Username is not a required field anymore. If empty - email from identity
is used.
This commit is contained in:
5
SQL/mysql/2016060200.sql
Normal file
5
SQL/mysql/2016060200.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
ALTER TABLE
|
||||
ident_switch
|
||||
MODIFY
|
||||
username
|
||||
varchar(64);
|
||||
5
SQL/postgres/2016060200.sql
Normal file
5
SQL/postgres/2016060200.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
ALTER TABLE
|
||||
ident_switch
|
||||
ALTER COLUMN
|
||||
username
|
||||
DROP NOT NULL;
|
||||
@@ -84,6 +84,15 @@ class ident_switch extends rcube_plugin
|
||||
$lbl = $r['label'];
|
||||
if (!$lbl)
|
||||
{
|
||||
if (!$r['username'])
|
||||
{ // Load email from identity
|
||||
$sql = 'SELECT email FROM ' . $rc->db->table_name('identities') . ' WHERE identity_id = ?';
|
||||
$q = $rc->db->query($sql, $r['iid']);
|
||||
$rIid = $rc->db->fetch_assoc($q);
|
||||
|
||||
$r['username'] = $rIid['email'];
|
||||
}
|
||||
|
||||
if (strpos($r['username'], '@') === false)
|
||||
$lbl = $r['username'] . '@' . ($r['host'] ? $r['host'] : 'localhost');
|
||||
else
|
||||
@@ -167,7 +176,7 @@ class ident_switch extends rcube_plugin
|
||||
'onchange' => 'plugin_switchIdent_secure_onChange();'
|
||||
),
|
||||
'ident_switch.form.port' => array('type' => 'text', 'size' => 5),
|
||||
'ident_switch.form.username' => array('type' => 'text', 'size' => 64),
|
||||
'ident_switch.form.username' => array('type' => 'text', 'size' => 64, 'placeholder' => $args['record']['email']),
|
||||
'ident_switch.form.password' => array('type' => 'password', 'size' => 64),
|
||||
'ident_switch.form.delimiter' => array('type' => 'text', 'size' => 1, 'placeholder' => '.'),
|
||||
),
|
||||
@@ -242,10 +251,6 @@ class ident_switch extends rcube_plugin
|
||||
if (strlen($fUser) > 64)
|
||||
$errMsg = 'user.long';
|
||||
else
|
||||
{
|
||||
if (!$fUser)
|
||||
$errMsg = 'user.empty';
|
||||
else
|
||||
{
|
||||
$fDelim = self::ntrim(get_input_value('_ident_switch_form_delimiter', RCUBE_INPUT_POST));
|
||||
if (strlen($fDelim) > 1)
|
||||
@@ -255,7 +260,6 @@ class ident_switch extends rcube_plugin
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($errMsg)
|
||||
{
|
||||
@@ -372,6 +376,15 @@ class ident_switch extends rcube_plugin
|
||||
$r = $rc->db->fetch_assoc($q);
|
||||
if (is_array($r))
|
||||
{
|
||||
if (!$r['username'])
|
||||
{ // Load email from identity
|
||||
$sql = 'SELECT email FROM ' . $rc->db->table_name('identities') . ' WHERE identity_id = ?';
|
||||
$q = $rc->db->query($sql, $r['iid']);
|
||||
$rIid = $rc->db->fetch_assoc($q);
|
||||
|
||||
$r['username'] = $rIid['email'];
|
||||
}
|
||||
|
||||
$rc->write_log(
|
||||
$this->my_log,
|
||||
'Switching mailbox to one for identity with ID = ' . $r['iid'] . ' (username = \'' . $r['username'] . '\').'
|
||||
|
||||
@@ -31,9 +31,6 @@ $labels['form.password'] = 'Password';
|
||||
// Folder hierarchy delimiter
|
||||
$labels['form.delimiter'] = 'Folder hierarchy delimiter';
|
||||
|
||||
// \'Username\' field in IMAP section cannot be empty.
|
||||
$labels['err.user.empty'] = '\'Username\' field in IMAP section cannot be empty.';
|
||||
|
||||
// Value in \'Label\' field of IMAP section is too long (32 chars max).
|
||||
$labels['err.label.long'] = 'Value in \'Label\' field of IMAP section is too long (32 chars max).';
|
||||
|
||||
|
||||
@@ -31,9 +31,6 @@ $labels['form.password'] = 'Пароль';
|
||||
// Folder hierarchy delimiter
|
||||
$labels['form.delimiter'] = 'Разделитель в иерархии папок';
|
||||
|
||||
// \'Username\' field in IMAP section cannot be empty.
|
||||
$labels['err.user.empty'] = '\'Имя пользователя\' в разделе IMAP не может быть пустым.';
|
||||
|
||||
// Value in \'Label\' field of IMAP section is too long (32 chars max).
|
||||
$labels['err.label.long'] = '\'Название\' в разделе IMAP должно быть не длинее 32 символов.';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user