diff --git a/classes/LBRY_Admin.php b/classes/LBRY_Admin.php index dabd79c..18cdac2 100644 --- a/classes/LBRY_Admin.php +++ b/classes/LBRY_Admin.php @@ -116,9 +116,20 @@ class LBRY_Admin */ public function sanitize($input) { - if (!empty($input['lbry_speech_pw'])) { + if (!empty($input[LBRY_SPEECH_CHANNEL])) { + $channel = $input[LBRY_SPEECH_CHANNEL]; + $channel = str_replace('@', '', $channel); + $input[LBRY_SPEECH_CHANNEL] = $channel; + } + + if (!empty($input[LBRY_SPEECH_PW])) { $encrypted = $this->encrypt($input['lbry_speech_pw']); - $input['lbry_speech_pw'] = $encrypted; + $input[LBRY_SPEECH_PW] = $encrypted; + } else { + // If we have a password and its empty, keep orginal password + if (!empty(get_option(LBRY_SETTINGS)[LBRY_SPEECH_PW])) { + $input[LBRY_SPEECH_PW] = get_option(LBRY_SETTINGS)[LBRY_SPEECH_PW]; + } } return $input; @@ -180,10 +191,9 @@ class LBRY_Admin public function speech_pw_callback() { printf( - 'options[LBRY_SPEECH_PW]) ? $this->get_pw_length() : '' + LBRY_SETTINGS ); } @@ -280,17 +290,6 @@ class LBRY_Admin } } - private function get_pw_length() - { - $pw = $this->options[LBRY_SPEECH_PW]; - if (empty($pw)) { - return ''; - } - $pw = $this->decrypt($pw); - $length = strlen($pw); - return str_repeat("X", $length); - } - private function encrypt($plaintext) { $ivlen = openssl_cipher_iv_length($cipher="AES-256-CTR"); diff --git a/classes/LBRY_Speech.php b/classes/LBRY_Speech.php index eab3ab3..f88929b 100644 --- a/classes/LBRY_Speech.php +++ b/classes/LBRY_Speech.php @@ -70,8 +70,11 @@ class LBRY_Speech $speech_channel = get_option(LBRY_SETTINGS)[LBRY_SPEECH_CHANNEL]; $speech_pw = LBRY()->admin->get_speech_pw(); if (!empty($speech_channel) && !empty($speech_pw)) { - $params['channelName'] = $speech_channel; + $params['channelName'] = '@' . $speech_channel; $params['channelPassword'] = $speech_pw; + + error_log($params['channelName']); + error_log($params['channelPassword']); } $ch = $this->build_request('publish', $params);