From dc6dbb4ac30043d842b440cf9cafede3bf70bcfc Mon Sep 17 00:00:00 2001 From: KayleMine <60858771+KayleMine@users.noreply.github.com> Date: Wed, 16 Aug 2023 15:41:25 +0300 Subject: [PATCH] Fix bug with user password expire. --- RAL/Form1.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/RAL/Form1.cs b/RAL/Form1.cs index b4b5de4..7fdf100 100644 --- a/RAL/Form1.cs +++ b/RAL/Form1.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Windows.Forms; using System.Diagnostics; @@ -126,6 +126,12 @@ private void button1_Click(object sender, EventArgs e) //create { log.Info("User groups - Add :: " + error.Message); MessageBox.Show(error.Message); } + // Set the PasswordNeverExpires property + int ADS_UF_DONT_EXPIRE_PASSWD = 0x10000; + int userFlags = (int)NewUser.Properties["UserFlags"].Value; + NewUser.Properties["UserFlags"].Value = userFlags | ADS_UF_DONT_EXPIRE_PASSWD; + + NewUser.CommitChanges(); Settings.Default.user = NameLog; Settings.Default.Save();