Change password validation
I am developing a windows application, my database is in MS-Access, i have made one ChangePassword Form this form will show error message if user tries to change password of some other user.
And i want that the user who have the admin rights will able to change the password of any user including itself. Please help me out.
Here is my coding,
try
{
ConnectionClass l_ConnectionClass = new ConnectionClass();
UserName = txtusername.Text;
oldPassword = txtoldpwd.Text;
newPassword = txtnewpwd.Text;
ConfirmnewPassword = txtconfirmpwd.Text;
DialogResult dlgResult = MessageBox.Show("Do you want to change your password.", "Continue?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
if (dlgResult == DialogResult.Yes)
{
l_ConnectionClass.changepassword(PublicVariables.OSUserID, UserName, oldPassword, newPassword, ConfirmnewPassword);
MessageBox.Show("Password Successfully Changed");
ClearFields();
}
else if (dlgResult == DialogResult.No)
{
ClearFields();
}
}
catch (Exception Ex)
{
MessageBox.Show("Connection Failed. Plz Check your Network Cable Connection", "Error", MessageBoxButtons.OK);
}
Please help with the coding