mirror of
				https://github.com/miawinter98/just-short-it.git
				synced 2025-11-04 01:25:27 +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 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");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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("~/");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in a new issue