Skip to content

Commit 10b55b6

Browse files
committed
Resolved return URL hash problem.
1 parent e6a8ddf commit 10b55b6

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

src/AbpCompanyName.AbpProjectName.WebSpaAngular/Controllers/AccountController.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public ActionResult Login(string returnUrl = "")
7575

7676
[HttpPost]
7777
[DisableAuditing]
78-
public async Task<JsonResult> Login(LoginViewModel loginModel, string returnUrl = "")
78+
public async Task<JsonResult> Login(LoginViewModel loginModel, string returnUrl = "", string returnUrlHash = "")
7979
{
8080
CheckModelState();
8181

@@ -92,6 +92,11 @@ public async Task<JsonResult> Login(LoginViewModel loginModel, string returnUrl
9292
returnUrl = Request.ApplicationPath;
9393
}
9494

95+
if (!string.IsNullOrWhiteSpace(returnUrlHash))
96+
{
97+
returnUrl = returnUrl + returnUrlHash;
98+
}
99+
95100
return Json(new MvcAjaxResponse { TargetUrl = returnUrl });
96101
}
97102

src/AbpCompanyName.AbpProjectName.WebSpaAngular/Views/Account/Login.cshtml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
</div>
5151
</div>
5252

53+
<input id="ReturnUrlHash" type="hidden" name="returnUrlHash" />
54+
5355
<div class="form-group">
5456
<div class="col-lg-12">
5557
<button id="LoginButton" type="submit" class="btn btn-primary"><i class="fa fa-sign-in"></i> @L("LogIn")</button>

src/AbpCompanyName.AbpProjectName.WebSpaAngular/Views/Account/Login.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(function () {
22

3-
$(function() {
3+
$(function () {
44
$('#LoginButton').click(function (e) {
55
e.preventDefault();
66
abp.ui.setBusy(
@@ -12,7 +12,8 @@
1212
tenancyName: $('#TenancyName').val(),
1313
usernameOrEmailAddress: $('#EmailAddressInput').val(),
1414
password: $('#PasswordInput').val(),
15-
rememberMe: $('#RememberMeInput').is(':checked')
15+
rememberMe: $('#RememberMeInput').is(':checked'),
16+
returnUrlHash: $('#ReturnUrlHash').val()
1617
})
1718
})
1819
);
@@ -25,6 +26,8 @@
2526
$form.submit();
2627
});
2728

29+
$('#ReturnUrlHash').val(location.hash);
30+
2831
$('#LoginForm input:first-child').focus();
2932
});
3033

0 commit comments

Comments
 (0)