Logout functionality in javascript

773 views
Skip to first unread message

masaki...@gmail.com

unread,
Dec 13, 2013, 5:37:38 AM12/13/13
to suppor...@runmyprocess.com
Hi Team,

I want a logout functionality to be added to my project,i have gone through the logout examples in the documentation and implemented the same.Although the page in which I have the logout button is getting redirected to home screen but the user data is still in session ,I mean am able to use the project without logging in again. So i need your support to develop this functionality in javascript!.


Thanks in Advance,


regards,
Masakini Rolls

Sabine El Rassy

unread,
Dec 13, 2013, 8:42:02 AM12/13/13
to RunMyProcess Support Forum

Hello Masakini,


You can try something like follow:

setInterval(function(){
$.ajax({
type : "GET",
data : {},
cache : false,
async : false,
dataType : "text",
success : function (data) {
},
error : function () {
$.ajax({
type : "GET",
data : {},
cache : false,
async : false,
dataType : "text",
success : function (data) {
window.location.reload();
},
error : function () {
window.location.reload();
}
});
}
});
},10000);

This function will check if the user is connected => success=> do nothing
error => it means the user is not logged in => call the logout and reload.
Add this JS to your Web Interface. If the user clicks on logout within another interface, credentials will be asked within the first interface as well.

Is that what you need?

Regards 

Sabine EL RASSY

masaki...@gmail.com

unread,
Dec 16, 2013, 7:22:41 AM12/16/13
to suppor...@runmyprocess.com, masaki...@gmail.com
Hi Sabine,


Thanks for the reply,the code which you have given is working but i want to make the user redirect to login page and ask him to enter the details there, rather than in an alert box which is the present implementation as per the code given.

Sabine El Rassy

unread,
Dec 16, 2013, 7:32:02 AM12/16/13
to RunMyProcess Support Forum, masaki...@gmail.com
Hello Masakini,

Try
window.location.href="new_page_on_logout";
instead of
window.location.reload();

Regards
Sabine
Reply all
Reply to author
Forward
0 new messages