R
Roy Gourgi
HI,
Why is this password authentication not working as I am sending? I am trying
to change the password and yet it is not working. What am I doing wrong?
TIA
Roy
using System;
public class Authenticator
{
private string Password;
public bool IsPasswordCorrect(string password)
{
return (password == Password) ? true : false;
}
public bool ChangePassword(string oldPassword, string newPassword)
{
if (oldPassword == Password)
{
Password = newPassword;
Console.WriteLine("Inside EQUAL {0} ",Password);
Console.ReadLine();
return true;
}
else
{
Console.WriteLine("Inside NOT EQUAL {0} ",Password);
Console.ReadLine();
return false;
}
}
}
class clsMain
{
static void Main()
{
Authenticator Simon = new Authenticator();
bool Done;
Done= Simon.ChangePassword("", "MyNewPassword");
if (Done==true)
Console.WriteLine("password for Simon changed");
else
Console.WriteLine("Failed to change password for Simon");
if (Simon.IsPasswordCorrect("what pw"))
Console.WriteLine("Verified ");
else
Console.WriteLine("NOT Verified ");
Console.ReadLine();
}
}
Why is this password authentication not working as I am sending? I am trying
to change the password and yet it is not working. What am I doing wrong?
TIA
Roy
using System;
public class Authenticator
{
private string Password;
public bool IsPasswordCorrect(string password)
{
return (password == Password) ? true : false;
}
public bool ChangePassword(string oldPassword, string newPassword)
{
if (oldPassword == Password)
{
Password = newPassword;
Console.WriteLine("Inside EQUAL {0} ",Password);
Console.ReadLine();
return true;
}
else
{
Console.WriteLine("Inside NOT EQUAL {0} ",Password);
Console.ReadLine();
return false;
}
}
}
class clsMain
{
static void Main()
{
Authenticator Simon = new Authenticator();
bool Done;
Done= Simon.ChangePassword("", "MyNewPassword");
if (Done==true)
Console.WriteLine("password for Simon changed");
else
Console.WriteLine("Failed to change password for Simon");
if (Simon.IsPasswordCorrect("what pw"))
Console.WriteLine("Verified ");
else
Console.WriteLine("NOT Verified ");
Console.ReadLine();
}
}