Skip to content

Commit

Permalink
Return URL to disallow external links
Browse files Browse the repository at this point in the history
  • Loading branch information
rxtur committed Oct 25, 2021
1 parent b14e98e commit e0301d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/Blogifier.Admin/Pages/Account/Login.razor.cs
Expand Up @@ -19,6 +19,9 @@ public async Task LoginUser()
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("returnUrl", out var param))
returnUrl = param.First();

if(returnUrl.StartsWith("http"))
returnUrl = "admin/";

var result = await Http.PostAsJsonAsync<LoginModel>("api/author/login", model);

if (result.IsSuccessStatusCode)
Expand Down
2 changes: 1 addition & 1 deletion src/Blogifier/Controllers/HomeController.cs
Expand Up @@ -63,7 +63,7 @@ public async Task<IActionResult> Index(string slug)
[HttpGet("/admin")]
public async Task<IActionResult> Admin()
{
return File("~/index.html", "text/html");
return await Task.FromResult(File("~/index.html", "text/html"));
}

[HttpPost]
Expand Down

0 comments on commit e0301d4

Please sign in to comment.