Added google and discord oauth2. Fixed menu bugs

This commit is contained in:
Marcel Baumgartner
2023-02-23 10:36:31 +01:00
parent 8f3f9fa1fb
commit 60693d25da
12 changed files with 555 additions and 47 deletions

View File

@@ -9,6 +9,7 @@
@using Moonlight.App.Services
@using Moonlight.App.Exceptions
@using Logging.Net
@using Moonlight.App.Services.OAuth2
@using Moonlight.App.Services.Sessions
@inject AlertService AlertService
@@ -16,6 +17,8 @@
@inject SmartTranslateService SmartTranslateService
@inject CookieService CookieService
@inject NavigationManager NavigationManager
@inject GoogleOAuth2Service GoogleOAuth2Service
@inject DiscordOAuth2Service DiscordOAuth2Service
<div class="d-flex flex-center">
<div class="card rounded-3 w-md-550px">
@@ -35,17 +38,17 @@
<div class="row g-3 mb-9">
<div class="col-md-6">
<a href="#" class="btn btn-flex btn-outline btn-text-gray-700 btn-active-color-primary bg-state-light flex-center text-nowrap w-100">
<a href="#" @onclick:preventDefault @onclick="DoDiscord" class="btn btn-flex btn-outline btn-text-gray-700 btn-active-color-primary bg-state-light flex-center text-nowrap w-100">
<div class="h-15px me-3">
<i class="bx bx-md bxl-discord-alt"></i>
<i class="mb-1 bx bx-md bxl-discord-alt"></i>
</div>
<TL>Sign in with Discord</TL>
</a>
</div>
<div class="col-md-6">
<a href="#" class="btn btn-flex btn-outline btn-text-gray-700 btn-active-color-primary bg-state-light flex-center text-nowrap w-100">
<a href="#" @onclick:preventDefault @onclick="DoGoogle" class="btn btn-flex btn-outline btn-text-gray-700 btn-active-color-primary bg-state-light flex-center text-nowrap w-100">
<div class="h-15px me-3">
<i class="bx bx-md bxl-google"></i>
<i class="mb-1 bx bx-md bxl-google"></i>
</div>
<TL>Sign in with Google</TL>
</a>
@@ -158,4 +161,16 @@
Logger.Error(e);
}
}
private async Task DoGoogle()
{
var url = await GoogleOAuth2Service.GetUrl();
NavigationManager.NavigateTo(url, true);
}
private async Task DoDiscord()
{
var url = await DiscordOAuth2Service.GetUrl();
NavigationManager.NavigateTo(url, true);
}
}