Thanks for the reference! I've added an OnAuthenticate event to the login control in LogonForm Webpart. Hope this will help the others who are looking for similar feature too.
protected void OnAuthenticate(object sender, AuthenticateEventArgs e)
{
bool Authenticated = false;
string userName = Login1.UserName.Trim();
if (UserInfoProvider.AuthenticateUser(userName, Login1.Password.Trim(), CMSContext.CurrentSite.SiteName) != null)
{
UserInfo ui = UserInfoProvider.GetUserInfo(userName);
CurrentSiteInfo si = CMSContext.CurrentSite;
if (ui != null && si != null)
{
// Check if user is online
if (SessionManager.IsUserOnline(si.SiteName, ui.UserID, true))
{
Authenticated = false;
Login1.FailureText = "Session is already in used.";
}
else
{
Authenticated = true;
}
}
}
e.Authenticated = Authenticated;
}