Subversion Repositories Code-Repo

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
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
{
12
    public partial class ResetUserPassword_Form : Form
13
    {
14
        private string selectedUsername;
15
        public ResetUserPassword_Form(string selectedUser)
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
        {
28
            // Office password is set here
29
            if (txt_Password1.Text == "tr33b3@rd")
30
            {
31
                this.txt_Password1.Visible = false;
32
                this.txt_Password2.Visible = true;
33
                this.lbl_Prompt1.Visible = false;
34
                this.lbl_Prompt2.Visible = true;
35
                this.txt_Password2.Focus();
36
            }
37
        }
38
        private void txt_Box2_TextChanged(object sender, EventArgs e)
39
        {
40
            TextBox tb = (TextBox)sender;
41
            if (tb.Text.Length == 0)
42
                this.btn_Ok.Enabled = false;
43
            else
44
                this.btn_Ok.Enabled = true;
45
        }
46
        private void btn_Cancel_Click(object sender, EventArgs e)
47
        {
48
            this.Close();
49
        }
50
        private void btn_Ok_Click(object sender, EventArgs e)
51
        {
52
            ManageUserAccounts.ChangeUserPassword(selectedUsername, txt_Password2.Text);
53
            this.Close();
54
        }
55
    }
56
}