public string GetCallbackResult() { string result = ""; UserInfo ui = UserInfoProvider.GetUserInfo(Login1.UserName); if (ui != null) { string siteName = SiteContext.CurrentSiteName; // Prepare return URL string returnUrl = RequestContext.CurrentURL; if (!string.IsNullOrEmpty(Login1.UserName)) { returnUrl = URLHelper.AddParameterToUrl(returnUrl, "username", Login1.UserName); } switch (UserAccountLockCode.ToEnum(ui.UserAccountLockReason)) { case UserAccountLockEnum.MaximumInvalidLogonAttemptsReached: result = AuthenticationHelper.SendUnlockAccountRequest(ui, siteName, "USERLOGON", SettingsKeyInfoProvider.GetValue(siteName + ".CMSSendPasswordEmailsFrom"), null, returnUrl); break; case UserAccountLockEnum.PasswordExpired: result = AuthenticationHelper.SendPasswordRequest(ui, siteName, "USERLOGON", SettingsKeyInfoProvider.GetValue(siteName + ".CMSSendPasswordEmailsFrom"), "Membership.PasswordExpired", null, AuthenticationHelper.GetResetPasswordUrl(siteName), returnUrl); break; } } return(result); }
protected void Page_PreRender(object sender, EventArgs e) { if (ui != null) { // Reset flag CheckBoxEnabled.Enabled = true; // Show warning message if (!ui.Enabled) { string description = null; if (ui.UserSettings.UserWaitingForApproval) { description = GetString("Administration-User_List.AccountLocked.WaitingForApproval"); } else { switch (UserAccountLockCode.ToEnum(ui.UserAccountLockReason)) { case UserAccountLockEnum.MaximumInvalidLogonAttemptsReached: description = GetString("Administration-User_List.AccountLocked.MaximumInvalidPasswordAttempts"); CheckBoxEnabled.Enabled = false; break; case UserAccountLockEnum.PasswordExpired: description = GetString("Administration-User_List.AccountLocked.PasswordExpired"); CheckBoxEnabled.Enabled = false; break; case UserAccountLockEnum.DisabledManually: description = GetString("Administration-User_List.AccountLocked.Disabledmanually"); break; } } ShowWarning(description); } // Check "modify" permission if (!CurrentUser.IsAuthorizedPerResource("CMS.Users", "Modify")) { btnExtendValidity.Enabled = btnResetLogonAttempts.Enabled = false; btnResetToken.Enabled = false; } // Display impersonation link if current user is global administrator if (CurrentMaster.HeaderActions.ActionsList != null) { var impersonateAction = CurrentMaster.HeaderActions.ActionsList.Find(a => a.CommandName == "impersonate"); if (impersonateAction != null) { if (CurrentUser.IsGlobalAdministrator && (ui != null) && (ui.UserID != CurrentUser.UserID) && !ui.IsPublic() && (!ui.IsGlobalAdministrator)) { string message = GetImpersonalMessage(ui); impersonateAction.OnClientClick = "if (!confirm('" + message + "')) { return false; }"; } else { impersonateAction.Visible = false; } } } } }