Switch to desktop version  
Logout for firmware 13 - Printable Version

+- Ewon Technical Forum (https://techforum.ewon.biz)
+-- Forum: Development (https://techforum.ewon.biz/forum-50.html)
+--- Forum: Custom Web Pages/viewON/Talk2M Visualization (https://techforum.ewon.biz/forum-55.html)
+--- Thread: Logout for firmware 13 (/thread-609.html)



Logout for firmware 13 - AngelaT - 10-05-2018

Hi everyone,

I have a custom homepage on my Flexy.  The page includes a link to the Flexy's internal interface and a link to logout.  Now that firmware 13.0 is out, I need to change those links.

Changing the link to the internal interface is easy - we go to /index.shtm now instead of /index.htm.  However, I haven't figured out the logout yet.  Before firmware 13, the link could just load /Ast/LoggedOffAst.shtm   What's the trick to log off from a custom webpage in firmware 13.0?

Thanks,
Angela


RE: Logout for firmware 13 - simon - 15-05-2018

Angela,

Try this script (that uses the viewon Tag "TimeCounter").
You have to paste it in a Javascript section - interval 1000 ms


Code:
var timeout = getViewOnTagVal('TimeCounter');
timeout += 1;

if ( timeout > 5 && typeof flag == 'undefined') //5 seconds timeout
{
    flag = true;
   
    if (!document.execCommand('ClearAuthenticationCache',true)) // Trident-based browsers check only (IE, Edge)
    {      
       var d = '111111111111',
       hostParts = window.location.href.split('/');
       url = hostParts[0] + '//'+d+':'+d+'@';

       if (window.location.href.indexOf("m2web.talk2m.com") > -1)      
         url += hostParts[2]  + '/' + hostParts[3]  + '/' +  hostParts[4]  +'/Ast/MainAst.shtm?nocache='+(new Date().getTime());
       else
         url += hostParts[2]  + '/Ast/MainAst.shtm?nocache='+(new Date().getTime());

       $.ajax(
       {
            type: "get",
            url: url,
            timeout: 15000,
            error: function(jqXHR, status)
            {
                 window.location.href = '../../usr/login.html';
            },
            // should not occur
            success: function(jqXHR, status)
            {
                 window.location.href = '../../usr/login.html';
            }
         });
    }
    else
    {
         window.location.href = '../../usr/login.html';
    }
   
}
else
{
    setViewOnTagVal('TimeCounter', timeout);
}


function get_hostname(url) {
   var m = url.match(/^http:\/\/[^/]+/);
   return m ? m[0] : null;
}



RE: Logout for firmware 13 - AngelaT - 15-05-2018

Thanks, Simon! I replaced '../../usr/login.html' with my custom home page and it worked like a charm.


RE: Logout for firmware 13 - insyncs - 24-10-2019

Hi,

This isnt working for me, FW 14.0 in development

"../../usr/login.html"

i just want to force a logout from my viewon project and re-direct to "../../usr/viewon/Home.shtm"

Any ideas?  Cheers M


RE: Logout for firmware 13 - simon - 30-10-2019

Hi,

Have you tried to replace "../../usr/login.html" by your page "Home.shtm" ?

Simon


RE: Logout for firmware 13 - insyncs - 30-10-2019

Like ../../usr/viewon/Home.shtm?

it takes me to the project home page, but it doesn't log me out?


RE: Logout for firmware 13 - simon - 30-10-2019

Hi,

Have you unchecked the option "Enable User page security" in the Ewon ? This one must be remain checked to make that working...

Simon


RE: Logout for firmware 13 - ziozetti - 25-08-2020

(30-10-2019, 07:27 PM)simon Wrote: Hi,

Have you unchecked the option "Enable User page security" in the Ewon ? This one must be remain checked to make that working...

Simon
Hi Simon,
I've followed your instruction and I also tried to analyse your project HERE but I can't logout nor after a counter nor pushing a button.
After 10 seconds the page set in javascript is loaded but I'm still logged in; in older firmware (ones with old style control panel layout) loading /Ast/LoggedOffAst.shtm logged out both from synoptic and from control panel.
With new firmwares if I reload synoptic after counter I'm still logged in.


RE: Logout for firmware 13 - simon - 25-08-2020

Hi,

I have just tried this project and it works well on my side.
Is it the same you are using ?

Simon


RE: Logout for firmware 13 - ziozetti - 28-08-2020

(25-08-2020, 02:39 PM)simon Wrote: Hi,

I have just tried this project and it works well on my side.
Is it the same you are using ?

Simon
My fault Simon, I was using another project: this project works and I managed to import javascript to my project but... can I use in the same view autologoff AND show which user is connected?

I admit that I don't understand Java at all and I don't know how to use both functions at the same time.
Thank you for your support!


RE: Logout for firmware 13 - simon - 01-09-2020

Perfect :-) Happy that it works for you.