Added user change status try catch, implement logout. password change admin

This commit is contained in:
Marcel Baumgartner
2023-04-20 12:29:01 +02:00
parent e79ec35bdc
commit 1b1bc80866
13 changed files with 116 additions and 43 deletions

View File

@@ -18,17 +18,19 @@ public class OAuth2Controller : Controller
private readonly DiscordOAuth2Service DiscordOAuth2Service;
private readonly UserRepository UserRepository;
private readonly UserService UserService;
private readonly DateTimeService DateTimeService;
public OAuth2Controller(
GoogleOAuth2Service googleOAuth2Service,
UserRepository userRepository,
UserService userService,
DiscordOAuth2Service discordOAuth2Service)
DiscordOAuth2Service discordOAuth2Service, DateTimeService dateTimeService)
{
GoogleOAuth2Service = googleOAuth2Service;
UserRepository = userRepository;
UserService = userService;
DiscordOAuth2Service = discordOAuth2Service;
DateTimeService = dateTimeService;
}
[HttpGet("google")]
@@ -63,7 +65,7 @@ public class OAuth2Controller : Controller
Response.Cookies.Append("token", token, new ()
{
Expires = new DateTimeOffset(DateTime.UtcNow.AddDays(10))
Expires = new DateTimeOffset(DateTimeService.GetCurrent().AddDays(10))
});
return Redirect("/");
@@ -121,7 +123,7 @@ public class OAuth2Controller : Controller
Response.Cookies.Append("token", token, new ()
{
Expires = new DateTimeOffset(DateTime.UtcNow.AddDays(10))
Expires = new DateTimeOffset(DateTimeService.GetCurrent().AddDays(10))
});
return Redirect("/");