/// <summary> /// Prepares the callback result. /// </summary> public string GetCallbackResult() { var user = MembershipContext.AuthenticatedUser; if (!user.Enabled) { return("accountLocked"); } if (userValidates) { if (RequestHelper.IsWindowsAuthentication()) { return(UnlockScreen()); } // User wants to revalidate his session if (UserInfoProvider.IsUserPasswordDifferent(user, validatePassword)) { // Password is invalid AuthenticationHelper.CheckInvalidPasswordAttempts(user, SiteContext.CurrentSiteName); if (!user.Enabled) { return("accountLocked"); } return("valbad"); } if (userWaitingForPasscode) { return(GeneratePasscode(user)); } // Password is correct return(UnlockScreen()); } if (passcValidates) { var membershipProvider = new CMSMembershipProvider(); if (membershipProvider.MFValidatePasscode(user, validatePasscode, false)) { return(UnlockScreen()); } if (!user.Enabled) { return("accountLocked"); } return("wrongPassc|" + GetString("mfauthentication.passcode.wrong")); } if (CMSPage.IsScreenLocked) { if (userAsksForState) { // Screen is locked return("isLocked|True"); } if (!userIsLoggingOut) { return(""); } // User wants to logout string signOutUrl = SystemContext.ApplicationPath.TrimEnd('/') + "/default.aspx"; if (IsCMSDesk) { // LiveID sign out URL is set if this LiveID session AuthenticationHelper.SignOut(ref signOutUrl); } else { AuthenticationHelper.SignOut(); } return("logout|" + signOutUrl); } // Check if ScreenLock is active if (!SecurityHelper.IsScreenLockEnabled(SiteContext.CurrentSiteName)) { return("disabled"); } // User is canceling countdown and wants to stay active if (userCanceling) { SecurityHelper.LogScreenLockAction(); return("cancelOk|" + SecurityHelper.GetSecondsToShowScreenLockAction(SiteContext.CurrentSiteName)); } if ((int)timeLeft.TotalSeconds <= 0) { // User was inactive too long - lock screen CMSPage.IsScreenLocked = true; return("lockScreen"); } if ((int)timeLeft.TotalSeconds <= secondsToWarning) { // Lock screen timeout is close - display warning return("showWarning|" + ((int)timeLeft.TotalSeconds).ToString()); } // User is active - hide warning and lock screen (if opened) return("hideWarning|" + ((int)timeLeft.TotalSeconds - secondsToWarning).ToString()); }
/// <summary> /// Prepares the callback result. /// </summary> public string GetCallbackResult() { CurrentUserInfo user = CMSContext.CurrentUser; if (userValidates) { if (!user.Enabled) { return("accountLocked"); } // User wants to revalidate his session if (UserInfoProvider.IsUserPasswordDifferent(user, validatePassword)) { // Password is invalid AuthenticationHelper.CheckInvalidPasswordAttempts(user, CMSContext.CurrentSiteName); if (!user.Enabled) { return("accountLocked"); } return("valbad"); } else { // Password is correct CMSPage.IsScreenLocked = false; SecurityHelper.LogScreenLockAction(); return("valok|" + SecurityHelper.GetSecondsToShowScreenLockAction(CMSContext.CurrentSiteName)); } } if (CMSPage.IsScreenLocked) { if (userAsksForState) { // Screen is locked return("isLocked|True"); } else if (userIsLoggingOut) { // User wants to logout string signOutUrl = URLHelper.ApplicationPath.TrimEnd('/') + "/default.aspx"; if (IsCMSDesk) { // LiveID sign out URL is set if this LiveID session CMSPage.SignOut(ref signOutUrl); } else { CMSPage.SignOut(); } return("logout|" + signOutUrl); } } else { // Check if ScreenLock is still enabled if (!SecurityHelper.IsScreenLockEnabled(CMSContext.CurrentSiteName)) { return("disabled"); } // User is canceling countdown and wants to stay active if (userCanceling) { SecurityHelper.LogScreenLockAction(); return("cancelOk|" + SecurityHelper.GetSecondsToShowScreenLockAction(CMSContext.CurrentSiteName)); } if ((int)timeLeft.TotalSeconds <= 0) { // User was inactive too long - lock screen CMSPage.IsScreenLocked = true; return("lockScreen"); } if ((int)timeLeft.TotalSeconds <= secondsToWarning) { // Lock screen timeout is close - display warning return("showWarning|" + ((int)timeLeft.TotalSeconds).ToString()); } else { // User is active - hide warning and lock screen (if opened) return("hideWarning|" + ((int)timeLeft.TotalSeconds - secondsToWarning).ToString()); } } return(""); }