Can anyone help me with implementing a scripted session log-off?

Hi guys,


I'm using Dundas to develop a website with dashboards and as part of my company's white labelling (which hides the side menu) it needs our own log-off button.

Now implementing a button on all the dashboards that takes the user to the log-in page is very easy. But what I also need is a script function that will end the (logged-in) session.


I can't find much help in the API guide. I only managed to find the currentSession in the develops console.


Could someone please point me in the right direction for information about how to go about scripting this?

On a button I put

this.getService("WebAppService").logOff();

This just kills the session, you still need to navigate to the log-in page - which you've worked out already.


You could also call

dundas.context.getService("WebAppService").logOff();

for the same effect.


I would recommend the first option. In general, I advise against using .context if at all possible, as it can become very messy very fast when embedding dashboards.

On the other hand, if you are not embedding dashboards, I prefer it because 'this' can become quite messy if you are doing loops etc. and you didn't grab it beforehand.


Not going to argue with Dundas' official policy though ;)

That's also a good point! :)

Thanks for your help. The first script worked as intended.

Sorry to revive this old thread...


I have a button that uses the first option. For whatever reason when I use Firefox, the session is still active. I don't have this problem in Chrome.


Any clue as to what's going on?

It just sends a JSON call that invalidates the session. There shouldn't be anything browser-specific in it, and it works for me when I try.


With that said, it may be a more fitting solution to simply navigate to /logon/logoff, which would both terminate the session and leave you on the logon page.