54 lines
1.8 KiB
Plaintext
54 lines
1.8 KiB
Plaintext
@page "/AuthFacebook/id={id}&fname={fname}&email={email}"
|
|
@inject NavigationManager _navigationManager
|
|
|
|
<h3>AuthFB</h3>
|
|
<h1>@valid</h1>
|
|
|
|
|
|
@code {
|
|
[Parameter] public string? id { get; set; }
|
|
[Parameter] public string? fname { get; set; }
|
|
[Parameter] public string? email { get; set; }
|
|
public string valid = "FALSE";
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
try
|
|
{
|
|
id = id ?? "NULL";
|
|
fname = fname ?? "NULL";
|
|
email = email ?? "NULL";
|
|
|
|
if (id != "NULL" && fname != "NULL" && email != "NULL")
|
|
{
|
|
valid = "TRUE\n" + id + " " + fname + " " + email;
|
|
|
|
Components.Layout.MainLayout.Session = new Dictionary<string, string>();
|
|
Components.Layout.MainLayout.Session.Add("login_method", "FB");
|
|
Components.Layout.MainLayout.Session.Add("id", id);
|
|
Components.Layout.MainLayout.Session.Add("fname", fname);
|
|
Components.Layout.MainLayout.Session.Add("email", email);
|
|
|
|
// Database call to add if it doesn't exist, or load LOCID if it does
|
|
await Components.CSharp.DatabaseDriver.SignIn("FB", id, fname, email);
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
// This is literally just to stop Blazor from blowing up due to running the above code twice.
|
|
// Blazor lifecycle quirks are going to cause generational damage to my liver.
|
|
}
|
|
await Task.Delay(0);
|
|
}
|
|
|
|
|
|
|
|
// Runs after OnInit, so we just use this to redirect since we know session will be configured by now
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
_navigationManager.NavigateTo("/Portal", true);
|
|
Console.WriteLine("Redirected to Portal");
|
|
await Task.Delay(0);
|
|
}
|
|
}
|