Force every user to log in each day when they first connect to the SuiteCRM

I have a requirement to configure company CRM to Force every user to log in each day when they first connect to the SuiteCRM. I’m thinking about to do this by setting up inactivity session timeout. I tried to setup the inactivity session time out using PHP.ini and .htaccess. both are not worked for me. :frowning: can anybody help me to sort-out this problem and any other approach to do this task also welcome.

I have read some posts were they talk about configuring session in PHP but people still complains about it not working.
Here is a post that talks about it: https://community.sugarcrm.com/thread/22024

Now I believe there is a way in SuiteCRM and we need to identify what the function is. That method is triggered when a user click on Reset User Preferences from profile. The system is automatically logged out. So, once we identify that method/function we might be able to trigger it from a schedule task so it logs out logged users at some point during the night.

I somebody has or can help us find it please share here.

Thanks,

AlxGr

Found these interesting lines under public function resetPreferences on

/modules/UserPreferences/UserPreference.php


...
            if ($user->id == $GLOBALS['current_user']->id) {
                session_destroy();
            }
...

That should be a good starting point…

Thanks,

AlxGr

1 Like

So exactly you are looking for.

  1. If a user is inactive for a few hours, let’s say 6 HOURS in your case.
  2. GRAB current user latest activity from “Tracker” table.
  3. convert this time into timestamp using strtotime.
  4. if current time is greater than 686400 , $cur_time - $tracker_time > 686400 , then , do session_destroy and redirect to login page.

Hope that helps.

1 Like

Thanks guys. will check and let u know…

I have a feeling that this should be possible to achieve simply with PHP/Web server configurations, these are typical session settings… I don’t think it calls for custom code.

I could be wrong, though…