working #14

Merged
derek merged 2 commits from working into main 2025-07-31 18:37:03 -07:00
3 changed files with 13 additions and 13 deletions
@@ -31,7 +31,7 @@ export class Authentication{
} }
get isLoggedIn(): boolean { get isLoggedIn(): boolean {
return this._user.value.id != -1 ? true : false; return this._user.value.id == null ? true : false;
} }
get loggedInUser(): Account { get loggedInUser(): Account {
@@ -43,7 +43,7 @@ namespace BoredCareers.Controllers {
signOut(); signOut();
return Redirect("/"); return Redirect("/");
} }
return NotFound(); return NotFound("Not logged in");
} }
} }
+5 -5
View File
@@ -89,18 +89,18 @@ if (IPayment._PaymentType == PaymentType.StripeIntent) {
RsaSecurityKey? PublicKey = null; RsaSecurityKey? PublicKey = null;
using (HttpClient client = new HttpClient()) { using (HttpClient client = new HttpClient()) {
while (PublicKey == null) {
HttpResponseMessage PublicKeyResponse = await client.GetAsync("https://auth.mistox.com/api/auth/publickey"); HttpResponseMessage PublicKeyResponse = await client.GetAsync("https://auth.mistox.com/api/auth/publickey");
if (PublicKeyResponse.IsSuccessStatusCode) { if (PublicKeyResponse.IsSuccessStatusCode) {
string publicKey = await PublicKeyResponse.Content.ReadAsStringAsync(); string publicKey = await PublicKeyResponse.Content.ReadAsStringAsync();
RSA rsa = RSA.Create(); using (RSA rsa = RSA.Create()) {
rsa.ImportFromPem(publicKey); rsa.ImportFromPem(publicKey);
PublicKey = new RsaSecurityKey(rsa); PublicKey = new RsaSecurityKey(rsa);
} }
} else {
await Task.Delay(2000); // sleep the main thread for 2 seconds before sending another request. Prevent DDOS of my own equiptment
}
} }
if (PublicKey == null) {
Console.WriteLine("Unable to load RSA PubKey Shutting Down");
Environment.Exit(100);
} }
builder.Services.AddAuthentication(options => { builder.Services.AddAuthentication(options => {