File tree 4 files changed +12
-1
lines changed
CheckDrive.Web/CheckDrive.Web
4 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -29,4 +29,12 @@ public async Task<IActionResult> Login(LoginRequest request)
29
29
30
30
return RedirectToAction ( "Index" , "Home" ) ;
31
31
}
32
+
33
+ [ HttpGet , Route ( "logout" ) ]
34
+ public IActionResult Logout ( )
35
+ {
36
+ authStore . Logout ( ) ;
37
+
38
+ return RedirectToAction ( nameof ( Login ) ) ;
39
+ }
32
40
}
Original file line number Diff line number Diff line change @@ -24,4 +24,6 @@ public async Task<TokenResponse> RefreshTokenAsync(RefreshTokenRequest request)
24
24
25
25
return response ;
26
26
}
27
+
28
+ public void Logout ( ) => cookieHandler . ClearTokens ( ) ;
27
29
}
Original file line number Diff line number Diff line change @@ -7,4 +7,5 @@ public interface IAuthStore
7
7
{
8
8
Task < TokenResponse > LoginAsync ( LoginRequest request ) ;
9
9
Task < TokenResponse > RefreshTokenAsync ( RefreshTokenRequest request ) ;
10
+ void Logout ( ) ;
10
11
}
Original file line number Diff line number Diff line change 41
41
<a href =" /accounts/details" style =" color :#1C375C " class =" fs-6 fw-bold" ><i class =" fa-regular fa-user" ></i > Shaxsiy kabinet</a >
42
42
</span >
43
43
<span >
44
- <a href = " /auth/login " class =" text-danger fs-6 fw-bold" ><i class =" fa-solid fa-right-from-bracket" ></i > Chiqish</a >
44
+ <a asp-action = " Logout " asp-controller = " Home " class =" text-danger fs-6 fw-bold" ><i class =" fa-solid fa-right-from-bracket" ></i > Chiqish</a >
45
45
</span >
46
46
</div >
47
47
</div >
You can’t perform that action at this time.
0 commit comments