_ChangePasswordPartial.cshtml 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. @using GreenTree.Nachtragsmanagement.Web.Extensions
  2. @model GreenTree.Nachtragsmanagement.Web.Models.Global.PasswordChangeDataModel
  3. <div class="changePasswordContainer">
  4. <script>
  5. function changePassword() {
  6. var form = $("#changePasswordEditForm");
  7. $(form).submit(function (e) {
  8. $.ajax({
  9. type: "POST",
  10. url: '@Url.Action("ChangePassword", "Global")',
  11. data: form.serialize(),
  12. success: function (response) {
  13. setTimeout(function () {
  14. $(".changePasswordContainer").remove();
  15. if (response == "success") {
  16. alert("Passwort erfolgreich geändert!");
  17. } else {
  18. $("body").append(response);
  19. }
  20. }, 200);
  21. }
  22. });
  23. e.preventDefault();
  24. });
  25. form.submit();
  26. }
  27. </script>
  28. <link rel="stylesheet" type="text/css" href="~/Content/function.css" />
  29. @Html.DevExpress().PopupControl(s =>
  30. {
  31. s.Name = "devPopupControlChangePassword";
  32. s.HeaderText = "Passwort ändern";
  33. s.ShowFooter = false;
  34. s.ShowMaximizeButton = false;
  35. s.Modal = true;
  36. s.ShowOnPageLoad = true;
  37. s.Width = new Unit(280, UnitType.Pixel);
  38. s.PopupHorizontalAlign = PopupHorizontalAlign.WindowCenter;
  39. s.PopupVerticalAlign = PopupVerticalAlign.WindowCenter;
  40. s.CloseAction = CloseAction.CloseButton;
  41. s.SetContent(() =>
  42. {
  43. using (Html.BeginForm("ChangePassword", "Global", FormMethod.Post, new { id = "changePasswordEditForm" }))
  44. {
  45. ViewContext.Writer.Write("<div class='editFormWrapper'>");
  46. ViewContext.Writer.Write(Html.CustomLabelFor(m => m.CurrentPassword, "Aktuelles Passwort:"));
  47. ViewContext.Writer.Write(Html.ValidationMessageFor(m => m.CurrentPassword).ToHtmlString());
  48. Html.DevExpress().TextBoxFor(m => m.CurrentPassword, t =>
  49. {
  50. t.Width = new Unit(100, UnitType.Percentage);
  51. t.Properties.Password = true;
  52. }).Render();
  53. ViewContext.Writer.Write(Html.CustomLabelFor(m => m.NewPassword, "Neues Passwort:"));
  54. ViewContext.Writer.Write(Html.ValidationMessageFor(m => m.NewPassword).ToHtmlString());
  55. Html.DevExpress().TextBoxFor(m => m.NewPassword, t =>
  56. {
  57. t.Width = new Unit(100, UnitType.Percentage);
  58. t.Properties.Password = true;
  59. }).Render();
  60. ViewContext.Writer.Write(Html.CustomLabelFor(m => m.ConfirmedPassword, "Neues Passwort bestätigen:"));
  61. ViewContext.Writer.Write(Html.ValidationMessageFor(m => m).ToHtmlString());
  62. Html.DevExpress().TextBoxFor(m => m.ConfirmedPassword, t =>
  63. {
  64. t.Width = new Unit(100, UnitType.Percentage);
  65. t.Properties.Password = true;
  66. }).Render();
  67. ViewContext.Writer.Write("</div>");
  68. Html.RenderPartial(
  69. "~/Views/Shared/_PopupButtonPanel.cshtml",
  70. new GreenTree.Nachtragsmanagement.Web.Models.Global.PopupModel
  71. {
  72. PopupName = "devPopupControlChangePassword",
  73. AcceptFunction = "function (s, e) { changePassword(); }"
  74. });
  75. }
  76. });
  77. s.Styles.Content.Paddings.Padding = new Unit(0);
  78. }).GetHtml()
  79. </div>