| 9 |
Kevin |
1 |
using System;
|
|
|
2 |
using System.Collections.Generic;
|
|
|
3 |
using System.ComponentModel;
|
|
|
4 |
using System.Data;
|
|
|
5 |
using System.Drawing;
|
|
|
6 |
using System.Linq;
|
|
|
7 |
using System.Text;
|
|
|
8 |
using System.Windows.Forms;
|
|
|
9 |
|
|
|
10 |
namespace SWAT_Office_App
|
|
|
11 |
{
|
| 63 |
Kevin |
12 |
public partial class Reset_User_Password_Form : Form
|
| 9 |
Kevin |
13 |
{
|
|
|
14 |
private string selectedUsername;
|
| 63 |
Kevin |
15 |
public Reset_User_Password_Form(string selectedUser)
|
| 9 |
Kevin |
16 |
{
|
|
|
17 |
selectedUsername = selectedUser;
|
|
|
18 |
InitializeComponent();
|
|
|
19 |
this.txt_Password1.Focus();
|
|
|
20 |
this.lbl_Prompt2.Visible = false;
|
|
|
21 |
|
|
|
22 |
// Monitors the text in each textbox, triggering changes when certain criteria is met
|
|
|
23 |
this.txt_Password1.TextChanged += new EventHandler(this.txt_Box1_TextChanged);
|
|
|
24 |
this.txt_Password2.TextChanged += new EventHandler(this.txt_Box2_TextChanged);
|
|
|
25 |
}
|
|
|
26 |
private void txt_Box1_TextChanged(object sender, EventArgs e)
|
|
|
27 |
{
|
| 53 |
Kevin |
28 |
if (txt_Password1.Text == Settings_Form.globalAdminPassword)
|
| 9 |
Kevin |
29 |
{
|
|
|
30 |
this.txt_Password1.Visible = false;
|
|
|
31 |
this.txt_Password2.Visible = true;
|
|
|
32 |
this.lbl_Prompt1.Visible = false;
|
|
|
33 |
this.lbl_Prompt2.Visible = true;
|
|
|
34 |
this.txt_Password2.Focus();
|
|
|
35 |
}
|
|
|
36 |
}
|
|
|
37 |
private void txt_Box2_TextChanged(object sender, EventArgs e)
|
|
|
38 |
{
|
|
|
39 |
TextBox tb = (TextBox)sender;
|
|
|
40 |
if (tb.Text.Length == 0)
|
|
|
41 |
this.btn_Ok.Enabled = false;
|
|
|
42 |
else
|
|
|
43 |
this.btn_Ok.Enabled = true;
|
|
|
44 |
}
|
|
|
45 |
private void btn_Cancel_Click(object sender, EventArgs e)
|
|
|
46 |
{
|
|
|
47 |
this.Close();
|
|
|
48 |
}
|
|
|
49 |
private void btn_Ok_Click(object sender, EventArgs e)
|
|
|
50 |
{
|
| 63 |
Kevin |
51 |
if (!Manage_User_Accounts.ChangeUserPassword(selectedUsername, txt_Password2.Text))
|
| 53 |
Kevin |
52 |
{
|
| 63 |
Kevin |
53 |
Debug.appendText("Error occured while changing password");
|
| 53 |
Kevin |
54 |
MessageBox.Show("Error occured while changing password", "Error");
|
|
|
55 |
}
|
| 9 |
Kevin |
56 |
this.Close();
|
|
|
57 |
}
|
|
|
58 |
}
|
|
|
59 |
}
|