Question

Hey Community,
I'm trying to log out a user through JS.Is there way to do it ?
I'm aware that the db of the usersession can be updated, but it does bring a popup to the screen.Is there a workaround?
eg :
if ( some condition)
{  some custom function

}
else 

{  log the user out.

}
I did it check out this article, but unsure as to how to implement it 
https://community.creatio.com/questions/how-logout-user-after-checking-…

Like 1

Like

2 comments
Best reply

Hi,

 

Yes, you can call

 

Terrasoft.MainMenuUtilities.logout();

 

to logout the user. You can even test it in the developer console in the browser (just execute this line in the console).

 

As for how to use it - depends on your business task. You can call this logout method as a button click handler or using any other conditions suitable.

Hi,

 

Yes, you can call

 

Terrasoft.MainMenuUtilities.logout();

 

to logout the user. You can even test it in the developer console in the browser (just execute this line in the console).

 

As for how to use it - depends on your business task. You can call this logout method as a button click handler or using any other conditions suitable.

Oleg Drobina,

Thank you , this worked fine in the console however
Tried this out. However my code is not able to access the MainMenuUtilities.

So used the below instead 
  
                          sessionStorage.clear();
                         localStorage.clear();
                        window.location.href = window.location.origin;

Show all comments

Hello,
When I log in to Creatio, then close the browser, reopen it, and try to access Creatio again, it turns out that I need to log in again. From what I understand, this is due to the fact that cookies are set to expire at the end of the session, so they are removed when the browser is closed. As a result, the system setting "UserSessionTimeout" is not being respected here. Is there any option to change this behavior?

Like 2

Like

1 comments

Hello,

 

When you close the browser, in this case, the value of UserSessionTimeout is generally not used. The browser, by default, should not delete cookies; this only happens if the user sets it up that way.

I also logged into the environment on a new browser with default settings, closed it, reopened it, and I was still logged into the environment, which is expected because the cookies still exist.

I would recommend checking the browser settings and how it handles cookies.

It seems that it's now easy to block third-party cookies, but our system stores third-party cookies, and, for example, in Chrome, this is called 'site data on the device,' where you can choose to clear everything when you close all windows.

Show all comments

Hello, 



I'm trying to create a popup to display to users after they start a new session (log in).  What is the simplest way to do this? 



There is a new business process called "User sessions" in the CRT Base package.  Is this something I could use for the purpose of displaying a popup after a new user session is created?



I was able to create a custom user task that displays a popup and call it with a business process with a simple start but cannot figure out a way for it to be triggered to display to a user when they start a new session.



Any guidance is appreciated.  Thank you!

 

 

Like 1

Like

1 comments

Hello,

 

Sessions are created directly in the database by Insert and do not generate an event on the object. Business processes rely on events at the object. If it is not the happening process will not notice any changes. As for now, there is no option to track start/end of the user session via the process signals. Our R&D team responsible for this functionality is already working on implementing it in the future releases. I will forward your feedback to the team in order to increase the importance of this task.

 

Best regards,

Yuliya

Show all comments

Hi there,

I am studying the user session object in order to make some dashboard.

There I found a column "session end method", where there are 0, 1, 2 ,3 as values.

What do these values mean?

 

Thanks in advance.

 

Like 0

Like

2 comments
Best reply

Hello Andrew, 

 

SessionEndMethod column values:

Not closed - 0

The session was closed as a result of the user logging out. - 1

The session was closed by a timeout on the server side. - 2

The session closed forcibly. - 3

 

Thank you, 

Igor

 

Hello Andrew, 

 

SessionEndMethod column values:

Not closed - 0

The session was closed as a result of the user logging out. - 1

The session was closed by a timeout on the server side. - 2

The session closed forcibly. - 3

 

Thank you, 

Igor

 

Ihor Skohariev,

Thank you Igor!

Show all comments