Login.cshtml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. @using IwbZero.Authorization.Base.Users
  2. @model ContractService.Models.Account.LoginFormViewModel
  3. @{
  4. ViewBag.Title = L("LogIn");
  5. }
  6. @section scripts
  7. {
  8. <script>
  9. (function () {
  10. $(function () {
  11. var $loginForm = $('#LoginForm');
  12. $loginForm.submit(function (e) {
  13. e.preventDefault();
  14. if (!$loginForm.valid()) {
  15. return;
  16. }
  17. abp.ui.setBusy(
  18. $('#LoginArea'),
  19. $.iwbAjax4({
  20. url: '/Account/Login',
  21. form: $loginForm,
  22. success: function () {
  23. abp.ui.setBusy();
  24. abp.message.success("登陆成功", "登陆");
  25. },
  26. error: function (error) {
  27. if (error.details) {
  28. return abp.message.error(error.details, error.message);
  29. } else {
  30. return abp.message.error(error.message || abp.ajax.defaultError.message);
  31. }
  32. }
  33. })
  34. );
  35. });
  36. $('a.social-login-link').click(function () {
  37. var $a = $(this);
  38. var $form = $a.closest('form');
  39. $form.find('input[name=provider]').val($a.attr('data-provider'));
  40. $form.submit();
  41. });
  42. $('input[name=returnUrlHash]').val(location.hash);
  43. $('#LoginForm input:first-child').focus();
  44. });
  45. })();
  46. function RememberChange(that) {
  47. var $that = $(that);
  48. $that.val($that.is(':checked'));
  49. }
  50. </script>
  51. }
  52. <h4 class="text-center">@L("LogIn")</h4>
  53. <form id="LoginForm">
  54. <input type="hidden" name="returnUrl" value="@Model.ReturnUrl" />
  55. <input type="hidden" name="returnUrlHash" />
  56. <div class="input-group mb-3">
  57. <input type="text" name="UsernameOrEmailAddress" class="form-control" placeholder="@L("UserNameOrEmail")" required autofocus maxlength="@UserBase.MaxEmailAddressLength">
  58. <div class="input-group-append">
  59. <div class="input-group-text">
  60. <span class="fa fa-user"></span>
  61. </div>
  62. </div>
  63. </div>
  64. <div class="input-group mb-3">
  65. <input type="password" class="form-control" name="Password" autocomplete="password" placeholder="@L("Password")" required maxlength="@UserBase.MaxPlainPasswordLength">
  66. <div class="input-group-append">
  67. <div class="input-group-text">
  68. <span class="fa fa-lock"></span>
  69. </div>
  70. </div>
  71. </div>
  72. <div class="row">
  73. <div class="col-8">
  74. <label class="iwb-checkbox iwb-white">
  75. <input data-index="0" name="RememberMe" id="RememberMe" type="checkbox" value="false" onchange="RememberChange(this)">
  76. <span></span>
  77. @L("RememberMe")
  78. </label>
  79. @*<div class="icheck-primary">
  80. <input type="checkbox" id="RememberMe" name="RememberMe" value="true">
  81. <label for="RememberMe">
  82. @L("RememberMe")
  83. </label>
  84. </div>*@
  85. </div>
  86. <div class="col-4">
  87. <button type="submit" id="LoginButton" class="btn btn-iwb btn-block btn-flat">@L("LogIn")</button>
  88. </div>
  89. </div>
  90. </form>
  91. <p class="mb-0">
  92. @if (Model.IsSelfRegistrationAllowed)
  93. {
  94. <div class="row">
  95. <div class="col-12">
  96. <a asp-action="Register" class="text-center"><i class="fa fa-plus-circle"></i> @L("Register")</a>
  97. </div>
  98. </div>
  99. }
  100. </p>