예제 #1
0
        private bool GeneratePinFromPassword()
        {
            UmConnectivityCredentialsHelper.DebugTrace("Inside GeneratePinFromPassword()", new object[0]);
            NetworkCredential networkCredential = new NetworkCredential(this.userName, string.Empty, this.domain);

            if (!UmConnectivityCredentialsHelper.FindPassword(this.exp, networkCredential))
            {
                UmConnectivityCredentialsHelper.DebugTrace("Inside GeneratePinFromPassword(): didnt find passwd", new object[0]);
                return(false);
            }
            try
            {
                UMMailboxPolicy policyFromUser = Utility.GetPolicyFromUser(this.aduser);
                if (!UmConnectivityCredentialsHelper.GetRandomPINFromPasswd(networkCredential.Password, policyFromUser.MinPINLength, out this.umPin))
                {
                    UmConnectivityCredentialsHelper.DebugTrace("Inside GeneratePinFromPassword(): didnt get pin", new object[0]);
                    return(false);
                }
            }
            catch (LocalizedException ex)
            {
                UmConnectivityCredentialsHelper.DebugTrace("Inside GeneratePinFromPassword(): got Exception = {0}", new object[]
                {
                    ex.ToString()
                });
                return(false);
            }
            return(true);
        }
예제 #2
0
        internal static bool ResetUMPin(ADUser aduser, string passwd)
        {
            UmConnectivityCredentialsHelper.DebugTrace("Inside UmConnectivityCredentialsHelper: ResetUMPin", new object[0]);
            string pin;

            try
            {
                UMMailboxPolicy policyFromUser = Utility.GetPolicyFromUser(aduser);
                if (!UmConnectivityCredentialsHelper.GetRandomPINFromPasswd(passwd, policyFromUser.MinPINLength, out pin))
                {
                    UmConnectivityCredentialsHelper.DebugTrace("Inside ResetUMPin(): didnt get pin", new object[0]);
                    return(false);
                }
            }
            catch (LocalizedException ex)
            {
                UmConnectivityCredentialsHelper.DebugTrace("Inside ResetUMPin(): got Exception = {0}", new object[]
                {
                    ex.ToString()
                });
                return(false);
            }
            LocalizedException ex2 = UmConnectivityCredentialsHelper.SaveUMPin(aduser, pin);

            if (ex2 != null)
            {
                UmConnectivityCredentialsHelper.DebugTrace("Inside ResetUMPin(): SaveUMPin Exception = {0}", new object[]
                {
                    ex2.ToString()
                });
                return(false);
            }
            return(true);
        }