mirror of
https://github.com/miawinter98/just-short-it.git
synced 2024-11-22 08:19:54 +00:00
fixed: login/logout not working with razor components
This commit is contained in:
parent
2f6f77baf6
commit
23a134c96e
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using JustShortIt.Model;
|
using JustShortIt.Model;
|
||||||
using Microsoft.AspNetCore.Authentication;
|
using Microsoft.AspNetCore.Authentication;
|
||||||
|
@ -42,7 +43,7 @@ public class LoginModel : PageModel {
|
||||||
new ClaimsPrincipal(identity),
|
new ClaimsPrincipal(identity),
|
||||||
properties);
|
properties);
|
||||||
|
|
||||||
return RedirectToPage("Urls");
|
return LocalRedirect("~/urls");
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelState.AddModelError(string.Empty, "Invalid Username or Password");
|
ModelState.AddModelError(string.Empty, "Invalid Username or Password");
|
||||||
|
|
|
@ -8,6 +8,6 @@ namespace JustShortIt.Pages;
|
||||||
public class LogoutModel : PageModel {
|
public class LogoutModel : PageModel {
|
||||||
public async Task<IActionResult> OnGetAsync() {
|
public async Task<IActionResult> OnGetAsync() {
|
||||||
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
||||||
return RedirectToPage("Index");
|
return LocalRedirect("~/");
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue