connortechnology / ZoneMinder

ZoneMinder is a free, open source Closed-circuit television software application developed for Linux which supports IP, USB and Analog cameras.
http://www.zoneminder.com/
GNU General Public License v2.0
9 stars 9 forks source link

auth_hash undefined #18

Closed digital-gnome closed 7 years ago

digital-gnome commented 7 years ago

On Ubuntu 16.04.3 using version 1.31.3~20170829105105-xenial from the PPA the live feed page will not display State, FPS, Disable Alarms link or any events. Force Alarm link does not work and throws an error.

It works if AUTH_HASH_LOGINS is enabled because auth_hash is defined and everything is happy. If AUTH_HASH_LOGINS is disabled auth_hash is unreferenced when watch.js tries to check if it needs to add it to the CmdParms variables. I fixed mine by changing web/skins/classic/js/skin.js.php from

<?php if ( ZM_OPT_USE_AUTH && ZM_AUTH_HASH_LOGINS ) { ?>
var auth_hash = '<?php echo isset($_SESSION['AuthHash']) ? $_SESSION['AuthHash'] : ''; ?>';
<?php } ?>

to

var auth_hash;

<?php if ( ZM_OPT_USE_AUTH && ZM_AUTH_HASH_LOGINS ) { ?>
var auth_hash = '<?php echo isset($_SESSION['AuthHash']) ? $_SESSION['AuthHash'] : ''; ?>';
<?php } ?>

This appears to initialize it so everything is happy even if you don't have hash logins on.

Relevant log lines:

2017-09-03 11:32:32.117936 | web_js |   | 1003 | ERR | Uncaught ReferenceError: auth_hash is not defined | http://192.168.2.238/zm/skins/classic/views/js/watch.js | 97

2017-09-02 22:36:53.498759 | web_js |   | 854 | ERR | Uncaught TypeError: Cannot read property 'send' of undefined | http://192.168.2.238/zm/skins/classic/views/js/watch.js | 383
connortechnology commented 7 years ago

You are right, I have pushed the fix.