Click here to Skip to main content
15,891,372 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
(Stored Procedure (ManageMember))
SQL
if @Check ='u' begin
	update Member

	set Password = @Password, Name = @Name, Email = @Email, Phone = @Phone, 
        Company = @Company, Gender = @Gender, BirthDate = @BirthDate,
        Question = @Question, Answer = @Answer

	where (UserName = @Username)
	end

----------------------------------------------------------------------------
(MainTable.cs)
C#
public bool Update()
    {
        return LoadPropertiesToList("u");
    }

----------------------------------------------------------------------------
(Member.cs)
C#
protected override bool LoadPropertiesToList(string TypeOfOperation)
    {
        SortedList SL = new SortedList();
        SL.Add("@Check", TypeOfOperation);
        SL.Add("@Username", Username);
        SL.Add("@Password", Password);
        SL.Add("@Name", Name);
        SL.Add("@Email", Email);
        SL.Add("@Phone", Phone);
        SL.Add("@Company", Company);
        SL.Add("@Gender", Gender);
        SL.Add("@BirthDate", BirthDate);
        SL.Add("@Question", Question);
        SL.Add("@Answer", Answer);
        ProcedureName = "ManageMember";
        
        if (db.RunProcedure(ProcedureName, SL) == 1)
            return true;
        else
            return false;
    }

------------------------------------------------------------------------------
(Utility.cs)
C#
public static string ReadFromCookie(string CookieName,string Key,HttpRequest req)
{
    try
    {
        return req.Cookies[CookieName][Key].ToString();
    }
    catch
    {
        return null;
    }
}

---------------------------------------------------------------------------
(wucLogin.ascx.cs)
C#
protected void Page_Load(object sender, EventArgs e)
{
string User = Utility.ReadFromCookie("Login","Username", Request);

if (User != null)
{
Redirect(User);
}
}

----------------------------------------------------------------------------------
(wucChangePassword.ascx.cs)
C#
{
Member M = new Member();
static string User;

protected void Page_Load(object sender, EventArgs e)
{
User = Utility.ReadFromCookie("Login", "Username", Request);
lblUser.Text = User;
}
protected void btnChange_Click(object sender, EventArgs e)
{
User = Utility.ReadFromCookie("Login", "Username", Request);

if (txtNewPass.Text != txtRePass.Text)
lblMsgPass.Text = "The Password and Confirm Password is not the same";
else
{
if (M.ChangePassword(User, txtNewPass.Text))
lblMsgPass.Text = "Password Changed Successfuly";
else
lblMsgPass.Text = "Something Error";
}
}
}


What I have tried:

C#
public bool ChangePassword(string Username, string NewPassword)
    {
        ????????????????????????????????
    }
Posted
Updated 11-May-17 19:54pm
v2
Comments
[no name] 11-May-17 20:29pm    
Just posting your unformatted code into a posting and typing in a bunch of ??????? marks is not a question. We are not "debug my homework assignment" service. Ask your teacher why he advocates the unsafe practice of storing plain text passwords into a database and then ask him to teach you correctly.
Bryian Tan 11-May-17 22:48pm    
What is ??????????????? is that encrypted?
Patrice T 12-May-17 0:35am    
And you have a question or a problem ?

1 solution

Stop trying to get that working, and sort out your passwords system: Never store passwords in clear text - it is a major security risk. There is some information on how to do it here: Password Storage: How to do it.[^]
Storing passwords in clear text is a codecrime[^] so all of the work you have put into this is pretty much wasted...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900