ProjectLighthouse/ProjectLighthouse.Servers.Website/Pages/ExternalAuth/AuthenticationPage.cshtml
Josh 19ea44e0e2
Rework login and registration systems (#600)
* Initial work for verifying login ticket signatures

* Add candidate psn public key

* Add candidate psn public key and fix nuget packages

* Finalize npticket changes

* Add support for ticket version 3.0

* Rework login system to link platform accounts instead of using ip addresses

* Make linked accounts green instead of blue

* Fix api building

* Fix unit tests

* Actually fix unit tests

* Set unit test user's linked platform

* Why was this the wrong default value?

* Fix username change code

* Make TicketHash hash the entire ticket instead of just the serial

* Send password setup email when user sets their email for the first time

* Changes from self review
2022-12-26 01:03:14 -08:00

84 lines
No EOL
2.9 KiB
Text

@page "/authentication"
@using LBPUnion.ProjectLighthouse.PlayerData
@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.ExternalAuth.AuthenticationPage
@{
Layout = "Layouts/BaseLayout";
Model.Title = "Linked Accounts";
string timeZone = Model.GetTimeZone();
TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(timeZone);
}
@if (Model.LinkAttempts.Count == 0)
{
<p>You have no pending link attempts.</p>
}
else
{
<p>You have @Model.LinkAttempts.Count authentication attempts pending.</p>
@if (Model.IpAddress != null)
{
<p>This device's IP address is <b>@(Model.IpAddress.ToString())</b>. If this matches with a link attempt below, then it's safe to assume the link attempt came from the same network as this device.</p>
}
}
@foreach (PlatformLinkAttempt authAttempt in Model.LinkAttempts)
{
DateTimeOffset timestamp = TimeZoneInfo.ConvertTime(DateTimeOffset.FromUnixTimeMilliseconds(authAttempt.Timestamp), timeZoneInfo);
<div class="ui red segment">
<p>A <b>@authAttempt.Platform</b> link request was logged at <b>@timestamp.ToString("M/d/yyyy @ h:mm tt")</b> from the IP address <b>@authAttempt.IPAddress</b>.</p>
<p><i class="yellow warning icon"></i> If you approve this request it will override any other linked accounts you have</p>
<div>
<a href="/authentication/approve/@authAttempt.PlatformLinkAttemptId">
<button class="ui small green button">
<i class="check icon"></i>
<span>Approve</span>
</button>
</a>
<a href="/authentication/deny/@authAttempt.PlatformLinkAttemptId">
<button class="ui small red button">
<i class="x icon"></i>
<span>Deny</span>
</button>
</a>
</div>
</div>
}
<div style="display: inline-block">
<h3 style="display: inline-block">PSN: </h3>
@if (Model.User?.LinkedPsnId != 0)
{
<div class="ui green button" style="cursor: default; pointer-events: none">
Linked
</div>
<a href="/authentication/unlink/psn" style="display: block; color: orangered">
Click here to unlink this platform
</a>
}
else
{
<button class="ui button" style="cursor: default; pointer-events: none">
Unlinked
</button>
}
</div>
<div class="ui divider"></div>
<div>
<h3 style="display: inline-block">RPCN: </h3>
@if (Model.User?.LinkedRpcnId != 0)
{
<div class="ui green button" style="cursor: default; pointer-events: none">
Linked
</div>
<a href="/authentication/unlink/rpcn" style="display: block; color: orangered">
Click here to unlink this platform
</a>
}
else
{
<button class="ui button" style="cursor: default; pointer-events: none">
Unlinked
</button>
}
</div>