コード例 #1
0
ファイル: PasswordExpire.cs プロジェクト: trondr/FiveChecks
        public static async Task <Result <PasswordExpiryInfo> > GetPasswordExpiryInfo()
        {
            if (!F.IsOnline())
            {
                return(new Result <PasswordExpiryInfo>(new Exception("Cannot contact domain controller to check password expiry")));
            }
            var userPasswordExpiryInfo = await PasswordExpire.GetPasswordExpiryStatus(Environment.UserName).ConfigureAwait(false);

            var passwordExpiryInfo = new PasswordExpiryInfo(userPasswordExpiryInfo.UserPasswordInfo.PasswordExpirationDate, userPasswordExpiryInfo.PasswordExpiryStatus, userPasswordExpiryInfo.IsRemoteSession);

            return(new Result <PasswordExpiryInfo>(passwordExpiryInfo));
        }
コード例 #2
0
ファイル: PasswordExpire.cs プロジェクト: trondr/FiveChecks
        private static ActionDismissToastContentInfo GetCheckPasswordExpiryToastContentInfo(Some <NotificationProfile> notificationProfile,
                                                                                            DateTime passwordExpirationDate, string groupName)
        {
            var title                = strings.PasswordExpiryNotification_Title;
            var content              = string.Format(CultureInfo.InvariantCulture, strings.PasswordExpiryNotification_Content_F0_F1, passwordExpirationDate.InPeriodFromNow(), passwordExpirationDate.ToString("yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture));
            var isRemoteSessions     = PasswordExpire.GetIsRemoteSession();
            var content2             = isRemoteSessions? strings.PasswordExpiryNotification_Content2: strings.PasswordExpiryNotification_Content2 + Environment.NewLine + Environment.NewLine + strings.PressCtrlAltDeleteToGetToTheWindowsSecurityDialog;
            var action               = isRemoteSessions? ToastActions.ChangePassword: string.Empty;
            var actionActivationType = ToastActivationType.Foreground;
            var greeting             = F.GetGreeting(notificationProfile);

            return(new ActionDismissToastContentInfo(greeting, title, content, content2, action, actionActivationType, isRemoteSessions ? strings.PasswordExpiryNotification_ActionButtonContent:string.Empty, strings.NotNowActionButtonContent, ToastActions.Dismiss, groupName, Option <string> .None, notificationProfile.Value.CompanyName));
        }
コード例 #3
0
        public static async Task <Result <ToastNotificationVisibility> > CheckPasswordExpiry(Some <NotificationProfile> userProfile, bool isDisabled)
        {
            var groupName = ToastGroups.CheckPasswordExpiry;
            var tag       = ToastGroups.CheckPasswordExpiry;
            var passwordExpiryCheckIsDisabled = Profile.IsCheckDisabled(isDisabled, typeof(CheckPasswordExpiryCommand));

            bool IsNonCompliant(PasswordExpiryInfo info) => info.PasswordExpiryStatus == PasswordExpiryStatus.ExpiringSoon;

            return(await CheckPasswordExpiryPure(
                       () => ComplianceInfo.LoadInfo <PasswordExpiryInfo>(PasswordExpire.LoadPasswordExpiryInfo, IsNonCompliant, ScheduledTasks.ComplianceUserMeasurements, true),
                       IsNonCompliant,
                       (passwordExpirationDate) => PasswordExpire.ShowPasswordExpiryToastNotification(userProfile, passwordExpirationDate, tag, groupName),
                       () => ToastHelper.RemoveToastNotification(groupName),
                       passwordExpiryCheckIsDisabled
                       ).ConfigureAwait(false));
        }