From fe920276911e44f42c4140ca77a3c27b0e2f31ff Mon Sep 17 00:00:00 2001 From: sj84 Date: Mon, 18 Sep 2023 13:46:07 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B9=84=EB=B0=80=EB=B2=88=ED=98=B8=20?= =?UTF-8?q?=EC=B4=88=EA=B8=B0=ED=99=94=20=EB=B6=80=EB=B6=84=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- INT69DC_7C/DialogForms/DialogFormYesNo.cs | 20 +++++ INT69DC_7C/Forms/FormUserEditor.cs | 32 +++++++- INT69DC_7C/Forms/FormUserEditor.designer.cs | 77 ++++++++++++++----- INT69DC_7C/Part11_UserManager/UserItem.cs | 7 ++ .../Part11_UserManager/UserManager.Define.cs | 3 + INT69DC_7C/Part11_UserManager/UserManager.cs | 11 +++ INT69DC_7C/Version.txt | 1 + 7 files changed, 127 insertions(+), 24 deletions(-) diff --git a/INT69DC_7C/DialogForms/DialogFormYesNo.cs b/INT69DC_7C/DialogForms/DialogFormYesNo.cs index ab1afb6..6965541 100644 --- a/INT69DC_7C/DialogForms/DialogFormYesNo.cs +++ b/INT69DC_7C/DialogForms/DialogFormYesNo.cs @@ -91,6 +91,10 @@ namespace INT69DC_7C.DialogForms this.labelErrorCode.Text = "이더넷"; this.labelMessage1.Text = "로컬IP주소 자동으로 설정하시겠습니까?"; break; + case 17: + this.labelErrorCode.Text = "로그인"; + this.labelMessage1.Text = "비밀번호를 초기화 하시겠습니까?"; + break; default: break; } @@ -164,6 +168,10 @@ namespace INT69DC_7C.DialogForms this.labelErrorCode.Text = "Ethernet"; this.labelMessage1.Text = "Do you want to set the local IP address to DHCP?"; break; + case 17: + this.labelErrorCode.Text = "Login"; + this.labelMessage1.Text = "Do you want to reset your password?"; + break; default: break; } @@ -239,6 +247,10 @@ namespace INT69DC_7C.DialogForms this.labelErrorCode.Text = "以太网"; this.labelMessage1.Text = "是否要将本地 IP 地址设置为 DHCP?"; break; + case 17: + this.labelErrorCode.Text = "登录"; + this.labelMessage1.Text = "您想重置密码吗?"; + break; default: break; } @@ -312,6 +324,10 @@ namespace INT69DC_7C.DialogForms this.labelErrorCode.Text = "Ethernet"; this.labelMessage1.Text = "Do you want to set the local IP address to DHCP?"; break; + case 17: + this.labelErrorCode.Text = "Přihlásit se"; + this.labelMessage1.Text = "Chcete obnovit své heslo?"; + break; default: break; } @@ -387,6 +403,10 @@ namespace INT69DC_7C.DialogForms this.labelErrorCode.Text = "Ethernet"; this.labelMessage1.Text = "Do you want to set the local IP address to DHCP?"; break; + case 17: + this.labelErrorCode.Text = "Einloggen"; + this.labelMessage1.Text = "Möchten Sie Ihr Passwort zurücksetzen?"; + break; default: break; } diff --git a/INT69DC_7C/Forms/FormUserEditor.cs b/INT69DC_7C/Forms/FormUserEditor.cs index 5f01421..16666b3 100644 --- a/INT69DC_7C/Forms/FormUserEditor.cs +++ b/INT69DC_7C/Forms/FormUserEditor.cs @@ -152,6 +152,8 @@ namespace INT69DC_7C.Forms } private void SetEnablePassword(bool value) { + value = false; + this.labelPassword.Enabled = value; if (value == true) @@ -483,7 +485,7 @@ namespace INT69DC_7C.Forms this.SelectedUserItem = new UserItem(); this.labelID.Text = ""; - this.labelPassword.Text = ""; + this.labelPassword.Text = this.SelectedUserItem.ResetPW; this.labelExpiryDateOfAccount.Text = "180"; this.labelExpiryDateOfPassword.Text = "90"; this.labelExpiryDateOfAccount2.Text = "yyyy.mm.DD"; @@ -599,7 +601,6 @@ namespace INT69DC_7C.Forms this.SelectedUserItem.IsFirstPassword = item.fFirstPW; } private void UpdateSelectUserDisplay(UserItem item) - { this.SetEnableID(false); @@ -665,7 +666,7 @@ namespace INT69DC_7C.Forms { this.buttonDelete.Visible = false; this.SetEnablePassword(true); - this.comboBoxAccessRight.Enabled = false; + this.comboBoxAccessRight.Enabled = false; } else { @@ -995,6 +996,31 @@ namespace INT69DC_7C.Forms UserManager.UserManager_UserDel(id); } } + private void buttonResetPW_Click(object sender, EventArgs e) + { + int ret = 0; + string id = "", pw = ""; + + if (this.listBoxUserList.Items.Count <= 1) + return; + + if (this.listBoxUserList.SelectItemIndex <= 0) + return; + + // 메시지 + // 비밀번호를 초기화 하시겠습니까? + DialogFormYesNo dlg = new DialogFormYesNo(this.ParentForm.SystemConfig.Language, 17); + if (dlg.ShowDialog() == DialogResult.Yes) + { + id = this.SelectedUserItem.ID; + pw = this.SelectedUserItem.ResetPW; + + ret = UserManager.UserManager_UserResetPWDirect(id, pw); + + if (ret == 0) + this.labelPassword.Text = pw; + } + } private void buttonGroupEditor_Click(object sender, EventArgs e) { diff --git a/INT69DC_7C/Forms/FormUserEditor.designer.cs b/INT69DC_7C/Forms/FormUserEditor.designer.cs index c9e76c8..d7c3360 100644 --- a/INT69DC_7C/Forms/FormUserEditor.designer.cs +++ b/INT69DC_7C/Forms/FormUserEditor.designer.cs @@ -50,6 +50,7 @@ this.labelAutomaticLogoutTime = new SmartX.SmartLabel(); this.buttonDelete = new SmartX.SmartButton(); this.smartGroupBox2 = new SmartX.SmartGroupBox(); + this.labelEquipment = new SmartX.SmartLabel(); this.labelMenu = new SmartX.SmartLabel(); this.labelMain = new SmartX.SmartLabel(); this.labelViewer = new SmartX.SmartLabel(); @@ -82,7 +83,7 @@ this.labelID = new SmartX.SmartLabel(); this.labelTitleID = new SmartX.SmartLabel(); this.buttonGroupEditor = new SmartX.SmartButton(); - this.labelEquipment = new SmartX.SmartLabel(); + this.buttonResetPW = new SmartX.SmartButton(); ((System.ComponentModel.ISupportInitialize)(this.smartForm1)).BeginInit(); this.smartGroupBox1.SuspendLayout(); this.smartGroupBox2.SuspendLayout(); @@ -110,7 +111,7 @@ this.labelTitle.BackPictureBox2 = null; this.labelTitle.BorderColor = System.Drawing.Color.Black; this.labelTitle.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.labelTitle.Font = new System.Drawing.Font("새굴림", 35F, System.Drawing.FontStyle.Bold); + this.labelTitle.Font = new System.Drawing.Font("New Gulim", 35F, System.Drawing.FontStyle.Bold); this.labelTitle.InitVisible = true; this.labelTitle.LineSpacing = 0F; this.labelTitle.Location = new System.Drawing.Point(199, 7); @@ -193,6 +194,7 @@ this.smartGroupBox1.BackColor = System.Drawing.Color.White; this.smartGroupBox1.BackPictureBox = this.smartForm1; this.smartGroupBox1.BackPictureBox1 = null; + this.smartGroupBox1.Controls.Add(this.buttonResetPW); this.smartGroupBox1.Controls.Add(this.comboBoxAccessRight); this.smartGroupBox1.Controls.Add(this.labelAccessRightAdmin); this.smartGroupBox1.Controls.Add(this.labelAutoLogoutWarning); @@ -236,7 +238,7 @@ // // comboBoxAccessRight // - this.comboBoxAccessRight.Font = new System.Drawing.Font("새굴림", 15F, System.Drawing.FontStyle.Regular); + this.comboBoxAccessRight.Font = new System.Drawing.Font("New Gulim", 15F, System.Drawing.FontStyle.Regular); this.comboBoxAccessRight.Location = new System.Drawing.Point(219, 156); this.comboBoxAccessRight.Name = "comboBoxAccessRight"; this.comboBoxAccessRight.Size = new System.Drawing.Size(291, 29); @@ -445,7 +447,7 @@ this.labelStatusExpiryPassword.BackPictureBox2 = null; this.labelStatusExpiryPassword.BorderColor = System.Drawing.Color.Black; this.labelStatusExpiryPassword.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.labelStatusExpiryPassword.Font = new System.Drawing.Font("새굴림", 10F, System.Drawing.FontStyle.Bold); + this.labelStatusExpiryPassword.Font = new System.Drawing.Font("New Gulim", 10F, System.Drawing.FontStyle.Bold); this.labelStatusExpiryPassword.ForeColor = System.Drawing.Color.DarkRed; this.labelStatusExpiryPassword.InitVisible = true; this.labelStatusExpiryPassword.LineSpacing = 0F; @@ -466,7 +468,7 @@ this.labelStatusExpiryAccount.BackPictureBox2 = null; this.labelStatusExpiryAccount.BorderColor = System.Drawing.Color.Black; this.labelStatusExpiryAccount.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.labelStatusExpiryAccount.Font = new System.Drawing.Font("새굴림", 10F, System.Drawing.FontStyle.Bold); + this.labelStatusExpiryAccount.Font = new System.Drawing.Font("New Gulim", 10F, System.Drawing.FontStyle.Bold); this.labelStatusExpiryAccount.ForeColor = System.Drawing.Color.DarkRed; this.labelStatusExpiryAccount.InitVisible = true; this.labelStatusExpiryAccount.LineSpacing = 0F; @@ -570,6 +572,24 @@ this.smartGroupBox2.Text = "Access right"; this.smartGroupBox2.TextColor = System.Drawing.Color.Black; // + // labelEquipment + // + this.labelEquipment.BackPictureBox = this.smartForm1; + this.labelEquipment.BackPictureBox1 = null; + this.labelEquipment.BackPictureBox2 = null; + this.labelEquipment.BorderColor = System.Drawing.Color.Black; + this.labelEquipment.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.labelEquipment.InitVisible = true; + this.labelEquipment.LineSpacing = 0F; + this.labelEquipment.Location = new System.Drawing.Point(427, 79); + this.labelEquipment.Name = "labelEquipment"; + this.labelEquipment.Size = new System.Drawing.Size(130, 18); + this.labelEquipment.TabIndex = 264; + this.labelEquipment.Text = "Equipment"; + this.labelEquipment.TextHAlign = SmartX.SmartLabel.TextHorAlign.Left; + this.labelEquipment.TextVAlign = SmartX.SmartLabel.TextVerAlign.Middle; + this.labelEquipment.Wordwrap = false; + // // labelMenu // this.labelMenu.BackColor = System.Drawing.Color.Black; @@ -1218,23 +1238,37 @@ this.buttonGroupEditor.UpImage = ((System.Drawing.Image)(resources.GetObject("buttonGroupEditor.UpImage"))); this.buttonGroupEditor.Click += new System.EventHandler(this.buttonGroupEditor_Click); // - // labelEquipment + // buttonResetPW // - this.labelEquipment.BackPictureBox = this.smartForm1; - this.labelEquipment.BackPictureBox1 = null; - this.labelEquipment.BackPictureBox2 = null; - this.labelEquipment.BorderColor = System.Drawing.Color.Black; - this.labelEquipment.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.labelEquipment.InitVisible = true; - this.labelEquipment.LineSpacing = 0F; - this.labelEquipment.Location = new System.Drawing.Point(427, 79); - this.labelEquipment.Name = "labelEquipment"; - this.labelEquipment.Size = new System.Drawing.Size(130, 18); - this.labelEquipment.TabIndex = 264; - this.labelEquipment.Text = "Equipment"; - this.labelEquipment.TextHAlign = SmartX.SmartLabel.TextHorAlign.Left; - this.labelEquipment.TextVAlign = SmartX.SmartLabel.TextVerAlign.Middle; - this.labelEquipment.Wordwrap = false; + this.buttonResetPW.BackPictureBox = null; + this.buttonResetPW.BackPictureBox1 = null; + this.buttonResetPW.BackPictureBox2 = null; + this.buttonResetPW.ButtonColor = System.Drawing.Color.Gainsboro; + this.buttonResetPW.ButtonImageAutoSize = true; + this.buttonResetPW.ColorKeySamplePosition = new System.Drawing.Point(0, 0); + this.buttonResetPW.DisableImage = null; + this.buttonResetPW.DownImage = null; + this.buttonResetPW.GroupID = 0; + this.buttonResetPW.InitVisible = true; + this.buttonResetPW.Location = new System.Drawing.Point(516, 120); + this.buttonResetPW.Mode = SmartX.SmartButton.BUTTONMODE.NORMAL; + this.buttonResetPW.Name = "buttonResetPW"; + this.buttonResetPW.NestedClickEventPrevent = false; + this.buttonResetPW.OutlinePixel = 1; + this.buttonResetPW.RepeatInterval = 200; + this.buttonResetPW.RepeatIntervalAccelerate = null; + this.buttonResetPW.SafeInterval = 200; + this.buttonResetPW.Size = new System.Drawing.Size(80, 30); + this.buttonResetPW.SpecialFunction = SmartX.SmartButton.SPECIALFUNC.NONE; + this.buttonResetPW.TabIndex = 243; + this.buttonResetPW.Text = "Reset"; + this.buttonResetPW.TextColor = System.Drawing.Color.Black; + this.buttonResetPW.TextDownColor = System.Drawing.Color.White; + this.buttonResetPW.TextHAlign = SmartX.SmartButton.TextHorAlign.Middle; + this.buttonResetPW.TextLocation = new System.Drawing.Point(0, 0); + this.buttonResetPW.TextVAlign = SmartX.SmartButton.TextVerAlign.Middle; + this.buttonResetPW.UpImage = null; + this.buttonResetPW.Click += new System.EventHandler(this.buttonResetPW_Click); // // FormUserEditor // @@ -1313,5 +1347,6 @@ private System.Windows.Forms.ComboBox comboBoxAccessRight; public SmartX.SmartLabel labelAccessRightAdmin; private SmartX.SmartLabel labelEquipment; + private SmartX.SmartButton buttonResetPW; } } \ No newline at end of file diff --git a/INT69DC_7C/Part11_UserManager/UserItem.cs b/INT69DC_7C/Part11_UserManager/UserItem.cs index c4056c4..a0a6a30 100644 --- a/INT69DC_7C/Part11_UserManager/UserItem.cs +++ b/INT69DC_7C/Part11_UserManager/UserItem.cs @@ -12,6 +12,7 @@ namespace INT69DC_7C.Part11_UserManager #region Field private string m_ID; private string m_Password; + private string m_ResetPW; private int m_ExpireId; private int m_ExpirePassword; @@ -51,6 +52,11 @@ namespace INT69DC_7C.Part11_UserManager get { return this.m_Password; } set { this.m_Password = value; } } + public string ResetPW + { + get { return this.m_ResetPW; } + private set { this.m_ResetPW = value; } + } public int ExpireId { @@ -125,6 +131,7 @@ namespace INT69DC_7C.Part11_UserManager { this.ID = "-"; this.Password = "-"; + this.ResetPW = "Password12!"; this.ExpireId = 0; this.ExpirePassword = 0; diff --git a/INT69DC_7C/Part11_UserManager/UserManager.Define.cs b/INT69DC_7C/Part11_UserManager/UserManager.Define.cs index bca150e..88cb104 100644 --- a/INT69DC_7C/Part11_UserManager/UserManager.Define.cs +++ b/INT69DC_7C/Part11_UserManager/UserManager.Define.cs @@ -131,6 +131,9 @@ namespace INT69DC_7C.Part11_UserManager [DllImport(PathDll, CallingConvention = CallingConvention.Winapi)] private static extern int DLL_UserMgr_UserModifyID(IntPtr user_org_id, IntPtr user_new_id); + [DllImport(PathDll, CallingConvention = CallingConvention.Winapi)] + private static extern int DLL_UserMgr_UserResetPWDirect(IntPtr user_id, IntPtr user_pw); + [DllImport(PathDll, CallingConvention = CallingConvention.Winapi)] private static extern int DLL_UserMgr_UserModifyOthers(IntPtr user_id, int fadmin, int expire_pw, int expire_account, int active_level); diff --git a/INT69DC_7C/Part11_UserManager/UserManager.cs b/INT69DC_7C/Part11_UserManager/UserManager.cs index e7636e5..514f91a 100644 --- a/INT69DC_7C/Part11_UserManager/UserManager.cs +++ b/INT69DC_7C/Part11_UserManager/UserManager.cs @@ -147,6 +147,17 @@ namespace INT69DC_7C.Part11_UserManager return ret; } + public static int UserManager_UserResetPWDirect(String sID, String sNewPW) + { + int ret = 0; + + IntPtr pID = Marshal.StringToBSTR(sID.ToString()); + IntPtr pPW = Marshal.StringToBSTR(sNewPW.ToString()); + + ret = DLL_UserMgr_UserResetPWDirect(pID, pPW); + + return ret; + } public static void UserManager_UserModifyID(String sID, String sNewID) { diff --git a/INT69DC_7C/Version.txt b/INT69DC_7C/Version.txt index a48338e..d825493 100644 --- a/INT69DC_7C/Version.txt +++ b/INT69DC_7C/Version.txt @@ -22,6 +22,7 @@ - Part 11 INT99DC_7C V3.0.2 ƽ 2忡 + PW ʱⰪ : Password12! - ͼ - ׽Ʈ(COM1, RS485) 'ȸ' ϴ