Muhammad Saifullah
Muhammad Saifullah

Reputation: 87

How to call - reset user password

I have define the employee userID at the login page in order to save the development time. At the login page there is a button called 'Reset Password'. The process is that when I click on the reset button, the password inside the database will become NULL for that userID. I have manage to call the userID, but do not know how to set the password to become NULL.

Below is my code for the process flow.

Employee emp = null;
string src = "07070";

if (TransState.GetType() == typeof(EnterUserId) || TransState.GetType() == typeof(EnterPassword))
{
      if (Auth.GetEmpoyeeClassByBarcode(src, out emp) == 1)
      {

           // set the ui button fo successful user login
           int x = LoginCheckBarcode(src, out emp);
           //                    loadTask(auth);
           // Direct to login menu 
           Param.Operation = Constant.LOGIN;
           ChangeState(typeof(TaskSelected));
           return 1;

       }
       else
       {
           return 0;
       }
 }

Upvotes: 0

Views: 92

Answers (1)

Anthony Michelizzi
Anthony Michelizzi

Reputation: 135

You need to have some extra validation other than just deleting the password otherwise anyone could just reset and delete the password and proceed to log in.

That being said, to change the password you would need to query your database which I assume is sql server since you list Winforms.

UPDATE table
SET password  = value
WHERE userID = value
;

Upvotes: 1

Related Questions