JS: Auto logout for idle user on a Remote Form
Mike Matthews
omnis at lineal.co.uk
Fri Dec 9 08:42:30 EST 2016
Thanks Graham.
I am using two built in methods that treasure total time connected and idle time. Both are good so far, but on the $destruct of the rtTask, I really wanted to switch forms, but it would appear that it is too late at this point. Once the $destruct sequence has started, then all too late.
So I'll try pushing a client side Ok message next.
Thanks
Mike
Mike Matthews,
Managing Director, SQLWorks Software Ltd
Tel: +44 (0)1271 375999
Email: mike.matthews at sqlworks.co.uk
Web: www.sqlworks.co.uk
Use SQLWorks, forget Sage, ACT!, Opera, Access & SAP
On 9 Dec 2016, at 12:30, Graham Stevens <graham.stevens at gmail.com> wrote:
> Hi Mike,
>
> We use this mechanism in the Conference app for the session registration form. And in the $destruct of the remote task we check if it is dying because of the timeout and push a message to the client. It could probably be a bit more sophisticated but here's the code if it's of any use.
>
> Rgds,
> Graham
>
> Remote Task
> irefForm is an instance variable of type item reference and is set by the remote form when it is instantiated
>
> $destruct
> Local variable
> ldtCurrent Date Time D m Y H:N:S.s
>
> Calculate ldtCurrent as #D
> If ldtCurrent-$cinst.$lastresponse>$cinst.$timeout*60*100 ;; convert $timeout in minutes to 100ths of a second
> ; send the timeout message to the client
> Do irefForm.$pushdata(row('Your server session has timed out due to inactivity. You will need to login again. Do you wish to do so now?'))
> End If
>
> JS Form methods (Execute on Client)
>
> $pushed
> Parameter pRow
>
> Do $cinst.$clientcommand('yesnomessage',row(pRow.C1,'','$refreshBrowser','$exitToUrl'))
>
> $refreshBrowser
> JavaScript: location.reload(true);
>
> $exitToUrl
> JavaScript: document.location.href="http://www.omnisworld.com";
>
>
> On 08-12-2016 20:54, Jeffrey Jones wrote:
>> In the remote task you could use.
>>
>> Timeouts
>>
>> You can control how long someone is connected to the Omnis App Server and how long a single client connection can remain idle, using the following properties.
>>
>> $maxtime
>> the maximum time in minutes that a client is allowed to stay connected; the default value is 0 which means the client can stay connected indefinitely.
>>
>> $timeout
>> the maximum time in minutes that a client is allowed to stay idle; the default value is 0 which means the client is allowed to stay idle indefinitely.
>>
>>
>>> On Dec 8, 2016, at 12:32 PM, Mike Matthews <omnis at lineal.co.uk> wrote:
>>>
>>> Hello All,
>>>
>>> To stop an Omnis licence being tied up for an extended period for JS users, what is the best strategy?
>>>
>>> I'm using v6.1 and thought of a $timer being run, and after each TAB or screen change or button click, the timer is restarted. And if it gets to 5 minutes of idle time, boom, away it goes to a different website.
>>>
>>> But is there a better way, or a built in one for Remote Form users?
>>>
>>> Thanks
>>>
>>> Mike
>>>
>>> _____________________________________________________________
>>> Manage your list subscriptions at http://lists.omnis-dev.com
>>>
>> _____________________________________________________________
>> Manage your list subscriptions at http://lists.omnis-dev.com
>
>
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
More information about the omnisdev-en
mailing list