Wednesday, April 6, 2016

Roundcube java script `beforelogin` event hook

Leave a Comment

I'm trying to add a login alert in roundcube, but I don't seem to get the client side events I expect. I want to listen to the beforelogin event.

My javascript code looks like this:

if (window.rcmail) {   rcmail.addEventListener('beforelogin', function() {     console.log("Got beforelogin");     window.alert("Alert");   });   rcmail.addEventListener('init', function() {     console.log("Got init");   }); } 

and it does log

Got init 

to the console log, but to my surprise it does not log

Got beforelogin 

nor does it display the alert.

Server side, the javascript is added by

class myalert extends rcube_plugin {     function init()     {         $this->add_hook('template_object_loginform', array($this,'myalert'));     }      function myalert($args)     {        $this->include_script('myalert.js');        return $args;     } } 

Did I misunderstand the naming conventions of roundcube client side events? Did I add it in the wrong way? Is there anything else I could have missed?

0 Answers

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment