fix it for real

This commit is contained in:
Niko Storni 2019-11-14 13:32:25 -05:00
parent c84e3606e9
commit 3892c52ec0
2 changed files with 8 additions and 6 deletions

View file

@ -88,13 +88,12 @@ class AcquisitionActions extends Actions
$current_value = LBRY::statusYoutube($status_token);
if ($current_value['data']['email'] == $email) {
if ($channel_name === null && $sync_consent === false) {
Controller::redirect("/youtube/status/". $status_token);
return Controller::redirect("/youtube/status/". $status_token);
}
$status = LBRY::editYoutube($status_token, $channel_name, null, $sync_consent);
} else {
$status = LBRY::editYoutube($status_token, $channel_name, $email, $sync_consent);
}
if ($status['success'] == false) {
Session::setFlash(Session::KEY_YOUTUBE_SYNC_ERROR, $status['error']);
Controller::redirect("/youtube/status/". $status_token);

View file

@ -1,11 +1,14 @@
<?php
$status_token = Request::encodeStringFromUser($_POST['status_token']);
$channel_name = null;
if (isset($_POST['new_preferred_channel'])) {
$channel_name = Request::encodeStringFromUser($_POST['new_preferred_channel']);
}
$email = Request::encodeStringFromUser($_POST['new_email']);
$sync_consent = isset($_POST['sync_consent']);
if ($channel_name !== "" && !preg_match("/@[A-Za-z0-9-]+$/", $channel_name)) {
if ($channel_name !== "" && $channel_name !== null && !preg_match("/@[A-Za-z0-9-]+$/", $channel_name)) {
$channel_name = "@" . $channel_name;
}