. */ class rcube_tinycp_password { public function save($currpass, $newpass, $username) { require_once 'TinyCPConnector.php'; $tinycp_host = rcmail::get_instance()->config->get('password_tinycp_host'); $tinycp_port = rcmail::get_instance()->config->get('password_tinycp_port'); $tinycp_user = rcmail::get_instance()->config->get('password_tinycp_user'); $tinycp_pass = rcmail::get_instance()->config->get('password_tinycp_pass'); $error_message = ''; if ($tinycp_host && $tinycp_port && $tinycp_user && $tinycp_pass) { try { $tcp = new TinyCPConnector($tinycp_host, $tinycp_port); $tcp->Auth($tinycp_user, $tinycp_pass); $tcp->mail___mailserver___email_pass_change2($username, $newpass); } catch (Exception $e) { $error_message = $e->getMessage(); } } else { $error_message = "Missing configuration value(s). "; } if ($error_message) { rcube::raise_error([ 'code' => 600, 'file' => __FILE__, 'line' => __LINE__, 'message' => "Password driver: $error_message", ], true, false ); return PASSWORD_ERROR; } return PASSWORD_SUCCESS; } }