PageRenderTime 59ms CodeModel.GetById 27ms RepoModel.GetById 1ms app.codeStats 0ms

/BaliEnterpriseSystems/BaliEnterpriseSystems/InitialPasswordChage.aspx.cs

https://github.com/sirivedula/BEST
C# | 37 lines | 33 code | 4 blank | 0 comment | 2 complexity | 4cc8ffc527f41811ae95fbde3853f5f5 MD5 | raw file
  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. namespace BaliEnterpriseSystems
  8. {
  9. public partial class InitialPasswordChage : System.Web.UI.Page
  10. {
  11. protected void Page_LoadComplete(object sender, EventArgs e)
  12. {
  13. if (Request.Form.Count > 0)
  14. {
  15. string newPassword = Request.Form["newpassword"];
  16. var cUser = Utils.User;
  17. cUser.BestUser.password = Utils.GetMD5Hash(newPassword);
  18. cUser.BestUser.initialPassword = false;
  19. cUser.BestUser.overrideEdit = true;
  20. cUser.BestUser.passwordExpiration = DateTime.Today.AddDays(365);
  21. if (!cUser.BestUser.CurrentRow.Save())
  22. {
  23. this.ChangePasswordMessage.Text = "<div class=\"err\">There was a problem changing your password. Please try again.</div>";
  24. }
  25. else
  26. {
  27. cUser.BestUser.IsLoggedIn = true;
  28. Response.Redirect("BestWelcome.aspx");
  29. }
  30. }
  31. }
  32. }
  33. }