ModiPassword.aspx.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. public partial class ModiPassword : System.Web.UI.Page
  8. {
  9. // UserData myud = new UserData();
  10. LYS.UserData1 myud = new LYS.UserData1();
  11. protected void Page_Load(object sender, EventArgs e)
  12. {
  13. }
  14. protected void Button1_Click(object sender, EventArgs e)
  15. {
  16. Boolean AC = myud.check_userlogin("UserS", "用户名", UserName.Text.ToString(), "密码", PassWord.Text.ToString());
  17. if (AC)
  18. {
  19. if (ReNewPassWord.Text == NewPassWord.Text)
  20. {
  21. //修改密码
  22. myud.UpdateUserPassword("UserS", NewPassWord.Text, "用户名", UserName.Text, "密码", PassWord.Text);
  23. Response.Write("<script>alert('密码修改成功!,请记住你的新密码是:(" + NewPassWord.Text + "),以便下次使用!')</script>");
  24. }
  25. else
  26. { Response.Write("<script>alert('两次输入新密码不同,请重新输入,并一定记住!')</script>"); }
  27. }
  28. else
  29. {
  30. Response.Write("<script>alert('用户名或密码错误,登录失败,无法修改密码!')</script>");
  31. }
  32. }
  33. }