Fixed double encryption of pwd when changing record (cannot connect

after change).
This commit is contained in:
Boris Gulay
2016-05-20 23:40:48 +03:00
parent 01edffa66b
commit 5a704f2717

View File

@@ -232,7 +232,7 @@ class ident_switch extends rcube_plugin
return $args; return $args;
} }
$sql = 'SELECT NULL FROM ' . $rc->db->table_name($this->table) . ' WHERE iid = ? AND user_id = ?'; $sql = 'SELECT password FROM ' . $rc->db->table_name($this->table) . ' WHERE iid = ? AND user_id = ?';
$q = $rc->db->query($sql, $args['id'], $rc->user->ID); $q = $rc->db->query($sql, $args['id'], $rc->user->ID);
$r = $rc->db->fetch_assoc($q); $r = $rc->db->fetch_assoc($q);
if ($r) if ($r)
@@ -255,6 +255,10 @@ class ident_switch extends rcube_plugin
if (get_input_value('_ident_switch_form_secure', RCUBE_INPUT_POST)) if (get_input_value('_ident_switch_form_secure', RCUBE_INPUT_POST))
$flags |= $this->db_secure; $flags |= $this->db_secure;
// Do we need to update pwd?
$fPass = get_input_value('_ident_switch_form_password', RCUBE_INPUT_POST);
if ($fPass != $r['password'])
$fPass = $rc->encrypt($fPass);
$rc->db->query( $rc->db->query(
$sql, $sql,
@@ -263,7 +267,7 @@ class ident_switch extends rcube_plugin
$fHost, $fHost,
$fPort, $fPort,
$fUser, $fUser,
$rc->encrypt(get_input_value('_ident_switch_form_password', RCUBE_INPUT_POST)), $fPass,
$fDelim, $fDelim,
$rc->user->ID, $rc->user->ID,
$args['id'] $args['id']