Beispiel #1
0
        public static Boolean checkAD(string username, string password)
        {
            // Attempt directory binds
            Boolean adValid = AD.checkPw(username, password);

            if (adValid)
            {
                log.Info(String.Format("Correct Active Directory password for user {0}", username));
                return(true);
            }
            else
            {
                log.Info(String.Format("Incorrect Active Directory password for user {0}", username));
                return(false);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Validates a user's passsword against various authentication sources
        /// </summary>
        /// <param name="username">username of user</param>
        /// <param name="password">password to validate</param>
        /// <param name="sync">whether the authentication sources are in sync</param>
        /// <returns>whether the user could succesfully bind to any directory</returns>
        public static Boolean checkPw(string username, string password)
        {
            Boolean adValid = AD.checkPw(username, password);

            // Return true if can bind to active directory
            if (adValid)
            {
                log.Info(String.Format("Correct old password for user {0}", username));
                return(true);
            }
            else
            {
                log.Info(String.Format("Incorrect old password for user {0}", username));
                log.Info(String.Format("{0} enabled: {1}", username, AD.isEnabled(username)));
                return(false);
            }
        }
Beispiel #3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string error;

            if (!DirMgr.isValidPassword(Password.Text, out error))
            {
                lblStatusVal.Text      = "Your password is not complex enough.  Please set a complex password and try again.";
                lblStatusVal.ForeColor = System.Drawing.Color.Red;

                log.Info(String.Format("Invalid password for {0}", Username.Text));
                return;
            }

            bool showDetails = false;

            if (DirMgr.checkAD(Username.Text, Password.Text))
            {
                ADPasswdStatus.Text      = "AD Password is correct.";
                ADPasswdStatus.ForeColor = System.Drawing.Color.Green;
                ADPasswdImage.ImageUrl   = "~/images/GreenCheckMark.png";
                showDetails = true;
            }
            else
            {
                ADPasswdStatus.Text      = "AD Password is incorrect.";
                ADPasswdStatus.ForeColor = System.Drawing.Color.Red;
                ADPasswdImage.ImageUrl   = "~/images/RedCheckMark.png";
            }

            /* if (DirMgr.checkED(Username.Text, Password.Text))
             * {
             *   EDPasswdStatus.Text = "eDirectory Password is correct.";
             *   EDPasswdStatus.ForeColor = System.Drawing.Color.Green;
             *   EDPasswdImage.ImageUrl = "~/images/GreenCheckMark.png";
             *   showDetails = true;
             * }
             * else
             * {
             *   EDPasswdStatus.Text = "eDirectory Password is incorrect.";
             *   EDPasswdStatus.ForeColor = System.Drawing.Color.Red;
             *   EDPasswdImage.ImageUrl = "~/images/RedCheckMark.png";
             * }*/

            if (Google.checkPw(Username.Text, Password.Text))
            {
                GooglePasswdStatus.Text      = "Google Device Password is correct.";
                GooglePasswdStatus.ForeColor = System.Drawing.Color.Green;
                GooglePasswdImage.ImageUrl   = "~/images/GreenCheckMark.png";
            }
            else
            {
                GooglePasswdStatus.Text      = "Google Device Password is incorrect.";
                GooglePasswdStatus.ForeColor = System.Drawing.Color.Red;
                GooglePasswdImage.ImageUrl   = "~/images/RedCheckMark.png";
            }


            if (showDetails)
            {
                TimeZoneInfo pacific = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time");

                if (AD.isEnabled(Username.Text))
                {
                    lblEnabled.Text = "Enabled";
                }
                else
                {
                    lblEnabled.Text = "Disabled";
                }

                DateTime?expiration = AD.getExpiration(Username.Text);
                if (expiration != null)
                {
                    lblExpiration.Text = (TimeZoneInfo.ConvertTime((DateTime)expiration, pacific)).ToString();
                }
                else
                {
                    lblExpiration.Text = "Never";
                }

                lblHome.Text = AD.getHome(Username.Text);

                DateTime?pwSet = AD.getLastPasswordSet(Username.Text);
                if (pwSet != null)
                {
                    lblPwSet.Text = (TimeZoneInfo.ConvertTime((DateTime)pwSet, pacific)).ToString();
                }
                else
                {
                    lblPwSet.Text = "Never";
                }
            }
        }
Beispiel #4
0
 public static void changePw(String username, String oldPassword, String newPassword)
 {
     log.Debug(String.Format("Changing AD password for user {0}", username));
     AD.setPw(username, newPassword);
 }
Beispiel #5
0
 public static void setPw(String username, String newPassword)
 {
     log.Debug(String.Format("Setting AD password for user {0}", username));
     AD.setPw(username, newPassword);
 }