function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
PRIYATAM REDDYPRIYATAM REDDY 

Prevent Username from being logged into multiple salesforce

How can i restrict users to login salesforce with same username from different sources (Desktop, Phone, Tablet) with same IP Address and similar login hours ?
Best Answer chosen by PRIYATAM REDDY
JLA.ovhJLA.ovh
You can monitor sessions in Setup > Seciroty Controls > Session Management
This can be done with SOQL too, selecting records from AuthSession object
If Parent SessionId is empty, it is probably a new session. If the type is UI, it is using the browser. If you have multiple sessions in the browser with no parent session, it is probably because you are logged in on multiple devices (or multiple browsers).
You could force a logout from oldest sessions to keep just the latest one, by deleting the related records from the AuthSession object
Pay attention that you should not block any new session if you already have an active session, because if I close my browser with an active session, I reopen it to login once again, my previous session can still run. I need to keep the freshest session

All Answers

JLA.ovhJLA.ovh
You can monitor sessions in Setup > Seciroty Controls > Session Management
This can be done with SOQL too, selecting records from AuthSession object
If Parent SessionId is empty, it is probably a new session. If the type is UI, it is using the browser. If you have multiple sessions in the browser with no parent session, it is probably because you are logged in on multiple devices (or multiple browsers).
You could force a logout from oldest sessions to keep just the latest one, by deleting the related records from the AuthSession object
Pay attention that you should not block any new session if you already have an active session, because if I close my browser with an active session, I reopen it to login once again, my previous session can still run. I need to keep the freshest session
This was selected as the best answer
fifedog15fifedog15
I beleive a better way now is to use the standard Transaction Security settings Salesforce provides.  Unsure when this feature came out but as of this post you can use it.

For postarity, there is a way now, at least as of July 2016. A very simple out of the box solution: Transaction Security by salesforce, see SFDC help topic (https://help.salesforce.com/HTViewHelpDoc?id=security_transactions_about.htm" target="_blank).

As of this time I don't see the setting in my Production Org, however it's there in all my dev orgs.  I'm unsure if you need to contact Salesforce to enable this feature for Production.

Screen shot of settings