1
0
Fork 0
mirror of https://github.com/miawinter98/just-short-it.git synced 2024-09-20 01:39:00 +00:00

fixed: login/logout not working with razor components

This commit is contained in:
Mia Rose Winter 2023-11-18 16:09:50 +01:00
parent 2f6f77baf6
commit 23a134c96e
Signed by: miawinter
GPG key ID: 4B6F6A83178F595E
2 changed files with 3 additions and 2 deletions

View file

@ -1,3 +1,4 @@
using System.Security.Claims;
using JustShortIt.Model;
using Microsoft.AspNetCore.Authentication;
@ -42,7 +43,7 @@ public class LoginModel : PageModel {
new ClaimsPrincipal(identity),
properties);
return RedirectToPage("Urls");
return LocalRedirect("~/urls");
}
ModelState.AddModelError(string.Empty, "Invalid Username or Password");

View file

@ -8,6 +8,6 @@ namespace JustShortIt.Pages;
public class LogoutModel : PageModel {
public async Task<IActionResult> OnGetAsync() {
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
return RedirectToPage("Index");
return LocalRedirect("~/");
}
}