From 61cde1557fa1c543fafdfa3a18331c555e6a9ad6 Mon Sep 17 00:00:00 2001 From: Lucas Bickel Date: Mon, 13 Mar 2017 20:39:21 +0100 Subject: [PATCH 1/4] Make password reset work for eveyone This stops distinguishing between superadmin users from whmcs vs regular local users on the password reset page. --- .../application/controllers/LoginController.php | 15 +++++++++++++-- airtime_mvc/application/forms/PasswordRestore.php | 2 -- airtime_mvc/application/models/Auth.php | 4 ++-- .../views/scripts/form/password-restore.phtml | 4 ++++ 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/airtime_mvc/application/controllers/LoginController.php b/airtime_mvc/application/controllers/LoginController.php index 2fbbfa724..c12a00153 100644 --- a/airtime_mvc/application/controllers/LoginController.php +++ b/airtime_mvc/application/controllers/LoginController.php @@ -156,7 +156,7 @@ class LoginController extends Zend_Controller_Action if ($request->isPost()) { if ($form->isValid($request->getPost())) { $query = CcSubjsQuery::create(); - $username = $form->userName->getValue(); + $username = $form->username->getValue(); $email = $form->email->getValue(); if (empty($username)) { @@ -179,7 +179,18 @@ class LoginController extends Zend_Controller_Action $form->email->addError($this->view->translate(_("Email could not be sent. Check your mail server settings and ensure it has been configured properly."))); } } else { - $form->email->addError($this->view->translate(sprintf(_pro("That username or email address could not be found. If you are the station owner, you should reset your here."), WHMCS_PASSWORD_RESET_URL))); + if (!LIBRETIME_ENABLE_WHMCS) { + $form->email->addError($this->view->translate(_("That username or email address could not be found."))); + } else { + $form->email->addError( + $this->view->translate( + sprintf( + _pro("That username or email address could not be found. If you are the station owner, you should reset your here."), + WHMCS_PASSWORD_RESET_URL + ) + ) + ); + } } } else { //Form is not valid $form->email->addError($this->view->translate(_("There was a problem with the username or email address you entered."))); diff --git a/airtime_mvc/application/forms/PasswordRestore.php b/airtime_mvc/application/forms/PasswordRestore.php index c6430a018..ec3621ca4 100644 --- a/airtime_mvc/application/forms/PasswordRestore.php +++ b/airtime_mvc/application/forms/PasswordRestore.php @@ -41,7 +41,6 @@ class Application_Form_PasswordRestore extends Zend_Form ) )); - /* $cancel = new Zend_Form_Element_Button("cancel"); $cancel->class = 'ui-button ui-widget ui-state-default ui-button-text-only center'; $cancel->setLabel(_("Back")) @@ -49,6 +48,5 @@ class Application_Form_PasswordRestore extends Zend_Form ->setAttrib('onclick', 'window.location = ' . Zend_Controller_Front::getInstance()->getBaseUrl('login')) ->setDecorators(array('ViewHelper')); $this->addElement($cancel); - */ } } diff --git a/airtime_mvc/application/models/Auth.php b/airtime_mvc/application/models/Auth.php index c05421925..03bd7f48b 100644 --- a/airtime_mvc/application/models/Auth.php +++ b/airtime_mvc/application/models/Auth.php @@ -32,8 +32,8 @@ class Application_Model_Auth $message = sprintf(_("Hi %s, \n\nPlease click this link to reset your password: "), $user->getDbLogin()); $message .= "{$e_link_protocol}://{$e_link_base}:{$e_link_port}{$e_link_path}"; - $message .= sprintf(_pro("\n\nIf you have any problems, please contact our support team: %s"), SUPPORT_ADDRESS); - $message .= sprintf(_pro("\n\nThank you,\nThe %s Team"), SAAS_PRODUCT_BRANDING_NAME); + $message .= sprintf(_("\n\nIf you have any problems, please contact our support team: %s"), SUPPORT_ADDRESS); + $message .= sprintf(_("\n\nThank you,\nThe %s Team"), SAAS_PRODUCT_BRANDING_NAME); $str = sprintf(_('%s Password Reset'), SAAS_PRODUCT_BRANDING_NAME); return Application_Model_Email::send($str, $message, $user->getDbEmail()); diff --git a/airtime_mvc/application/views/scripts/form/password-restore.phtml b/airtime_mvc/application/views/scripts/form/password-restore.phtml index 8f6be647b..809ba4120 100644 --- a/airtime_mvc/application/views/scripts/form/password-restore.phtml +++ b/airtime_mvc/application/views/scripts/form/password-restore.phtml @@ -1,3 +1,4 @@ +
Station Owners

@@ -5,8 +6,11 @@

+
+ DJs, Program Managers, and Others +
From 88b3eb22a068e415783c314bb7a5519f03bbb117 Mon Sep 17 00:00:00 2001 From: Lucas Bickel Date: Mon, 13 Mar 2017 20:46:39 +0100 Subject: [PATCH 2/4] Change default email sender The new noreply@ address is now libretime.org and the address gets moved to contants.php rather than being hardcoded in the email model. --- airtime_mvc/application/configs/constants.php | 1 + airtime_mvc/application/models/Email.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/configs/constants.php b/airtime_mvc/application/configs/constants.php index bb046fcda..e321f5a9c 100644 --- a/airtime_mvc/application/configs/constants.php +++ b/airtime_mvc/application/configs/constants.php @@ -25,6 +25,7 @@ define('AIRTIME_TRANSIFEX_URL' , 'http://libretime.org/translating/'); define('SUPPORT_TICKET_URL' , 'https://github.com/LibreTime/libretime/issues'); define('UI_REVAMP_EMBED_URL' , 'https://www.youtube.com/embed/nqpNnCKGluY'); define('LIBRETIME_WHATS_NEW_URL' , 'https://github.com/LibreTime/libretime/releases'); +define('LIBRETIME_EMAIL_FROM' , 'noreply@libretime.org'); define('LICENSE_VERSION' , 'GNU AGPL v.3'); define('LICENSE_URL' , 'http://www.gnu.org/licenses/agpl-3.0-standalone.html'); diff --git a/airtime_mvc/application/models/Email.php b/airtime_mvc/application/models/Email.php index 405c473d4..65cccd771 100644 --- a/airtime_mvc/application/models/Email.php +++ b/airtime_mvc/application/models/Email.php @@ -13,7 +13,7 @@ class Application_Model_Email */ public static function send($subject, $message, $to) { - $headers = sprintf('From: %s ', SAAS_PRODUCT_BRANDING_NAME); + $headers = sprintf('From: %s <%s>', SAAS_PRODUCT_BRANDING_NAME, LIBRETIME_EMAIL_FROM); return mail($to, $subject, $message, $headers); } From 7f8b73d9ae89c31c8f8eaa21c8953a84ced124bc Mon Sep 17 00:00:00 2001 From: Lucas Bickel Date: Mon, 13 Mar 2017 20:56:59 +0100 Subject: [PATCH 3/4] Add missing playout dependency --- installer/vagrant/centos.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/installer/vagrant/centos.sh b/installer/vagrant/centos.sh index 3b8700f57..2d8876021 100644 --- a/installer/vagrant/centos.sh +++ b/installer/vagrant/centos.sh @@ -91,7 +91,8 @@ yum install -y \ python-pip \ selinux-policy \ policycoreutils-python \ - python-celery + python-celery \ + lsof # for pip ssl install yum install -y \ From f31236fe66e363158b0b55b1070e06c54e13be37 Mon Sep 17 00:00:00 2001 From: Robb Ebright Date: Tue, 14 Mar 2017 23:03:37 -0400 Subject: [PATCH 4/4] Fixed Override Javascript and Functionality --- Vagrantfile | 4 +++- .../scripts/form/preferences_livestream.phtml | 18 +++++++++++++++--- airtime_mvc/public/css/styles.css | 11 +++++++++++ .../js/airtime/preferences/streamsetting.js | 15 +++++++-------- 4 files changed, 36 insertions(+), 12 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index ba74a5e3c..cf7c41192 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -9,8 +9,10 @@ Vagrant.configure("2") do |config| config.vm.network "forwarded_port", guest: 8000, host:8000 # liquidsoap input harbors for instreaming (ie. /master) config.vm.network "forwarded_port", guest: 8001, host:8001 - # mkdics documentation + config.vm.network "forwarded_port", guest: 8002, host:8002 + # mkdocs documentation config.vm.network "forwarded_port", guest: 8888, host:8888 + # make sure we are using nfs (doesn't work out of the box with debian) config.vm.synced_folder ".", "/vagrant", type: "nfs" diff --git a/airtime_mvc/application/views/scripts/form/preferences_livestream.phtml b/airtime_mvc/application/views/scripts/form/preferences_livestream.phtml index 788153bd2..ee7723f95 100644 --- a/airtime_mvc/application/views/scripts/form/preferences_livestream.phtml +++ b/airtime_mvc/application/views/scripts/form/preferences_livestream.phtml @@ -15,8 +15,13 @@ element->getElement('master_username')->render() ?> element->getElement('master_password')->render() ?> - element->getElement("master_source_host")->render() ?> - + element->getElement("master_source_host")->render() ?> +    +
+ +
element->getElement("master_source_port")->render() ?> element->getElement("master_source_mount")->render() ?>
@@ -26,8 +31,15 @@

- + element->getElement("show_source_host")->render() ?> +    + +
+ +
element->getElement("show_source_port")->render() ?> element->getElement("show_source_mount")->render() ?> diff --git a/airtime_mvc/public/css/styles.css b/airtime_mvc/public/css/styles.css index b11bcbf81..c616930ef 100644 --- a/airtime_mvc/public/css/styles.css +++ b/airtime_mvc/public/css/styles.css @@ -169,6 +169,17 @@ select { right:7px; line-height:16px !important; } +#connection_url_override { + position: relative; + display: inline-block; + float: left; + margin-left: 5px; +} + +#master_dj_connection_url_actions { + float:left; +} + #auto_switch_help, #auto_transition_help { right: 200px; diff --git a/airtime_mvc/public/js/airtime/preferences/streamsetting.js b/airtime_mvc/public/js/airtime/preferences/streamsetting.js index 6b9f7f07c..28c27e028 100644 --- a/airtime_mvc/public/js/airtime/preferences/streamsetting.js +++ b/airtime_mvc/public/js/airtime/preferences/streamsetting.js @@ -111,18 +111,17 @@ function checkLiquidsoapStatus(){ function setLiveSourceConnectionOverrideListener(){ $("[id=connection_url_override]").click(function(event){ - var url_input = $(this).parent().find("#stream_url").children(); + var url_input = $(this).parent().find("dd[id$='_source_host-element']").children(); url_input.removeAttr("readonly"); - $(this).parent().find("div[id$='_dj_connection_url_actions']").show(); event.preventDefault(); }); // set action for "OK" and "X" var live_dj_actions = $("#live_dj_connection_url_actions"); - var live_dj_input = live_dj_actions.parent().find("#stream_url").children(); + var live_dj_input = live_dj_actions.parent().find("dd[id$='_source_host-element']").children(); var master_dj_actions = $("#master_dj_connection_url_actions"); - var master_dj_input = master_dj_actions.parent().find("#stream_url").children(); + var master_dj_input = master_dj_actions.parent().find("dd[id$='_source_host-element']").children(); live_dj_actions.find("#ok").click(function(event){ event.preventDefault(); @@ -136,8 +135,8 @@ function setLiveSourceConnectionOverrideListener(){ live_dj_actions.find("#reset").click(function(event){ event.preventDefault(); - var port = $("#dj_harbor_input_port").val(); - var mount = $("#dj_harbor_input_mount_point").val(); + var port = $("#show_source_port").val(); + var mount = $("#show_source_mount").val(); var url = "http://"+location.hostname+":"+port+"/"+mount; if (port == '' || mount == '') { url = 'N/A'; @@ -159,8 +158,8 @@ function setLiveSourceConnectionOverrideListener(){ }); master_dj_actions.find("#reset").click(function(event){ - var port = $("#master_harbor_input_port").val(); - var mount = $("#master_harbor_input_mount_point").val(); + var port = $("#master_source_port").val(); + var mount = $("#master_source_mount").val(); var url = "http://"+location.hostname+":"+port+"/"+mount; if (port == '' || mount == '') { url = 'N/A';