private void bLogon_Click(object sender, EventArgs e) { if (user.GetUser(tbUID.Text)) { if (user.Password.Trim().Length == 0) { FormChgPwd form = new FormChgPwd(); form.UserName = tbUID.Text; form.Owner = this; form.ShowDialog(); } else { string encodePwd = esha.EncodeText(tbPWD.Text).Trim(); string savedPwd = user.Password.Trim(); if (user.Password.Trim() == encodePwd) { RuntimeDefaults.UserName = user.UserName; RuntimeDefaults.LoggedStatus = true; RuntimeDefaults.UserId = user.id; this.Close(); } else { MessageBox.Show("Password does not match"); return; } } } else { //Here we should add new admin user } }
private void FormChgPwd_Load(object sender, EventArgs e) { if (UserName != "") { tbUID.Text = UserName; bAdd.Enabled = false; bChgPwd.Enabled = true; usec.GetUser(UserName); tbFullName.Text = usec.FullName; tbUID.Enabled = false; } else { bAdd.Enabled = true; bChgPwd.Enabled = false; tbUID.Enabled = true; } }