mirror of
https://git.lewd.wtf/PGR/ascnet
synced 2025-12-13 06:34:38 +01:00
i forgor, the verify route for krsdk
This commit is contained in:
@@ -75,6 +75,38 @@ namespace AscNet.SDKServer.Controllers
|
||||
account
|
||||
});
|
||||
});
|
||||
|
||||
app.MapPost("/api/AscNet/verify", (HttpContext ctx) =>
|
||||
{
|
||||
AuthRequest? req = JsonConvert.DeserializeObject<AuthRequest>(Encoding.UTF8.GetString(ctx.Request.BodyReader.ReadAsync().Result.Buffer));
|
||||
|
||||
if (req is null || req.Token == string.Empty)
|
||||
{
|
||||
return JsonConvert.SerializeObject(new
|
||||
{
|
||||
code = -1,
|
||||
msg = "Invalid request"
|
||||
});
|
||||
}
|
||||
|
||||
Account? account = Account.FromToken(req.Token);
|
||||
|
||||
if (account == null)
|
||||
{
|
||||
return JsonConvert.SerializeObject(new
|
||||
{
|
||||
code = -1,
|
||||
msg = "Invalid credentials!"
|
||||
});
|
||||
}
|
||||
|
||||
return JsonConvert.SerializeObject(new
|
||||
{
|
||||
code = 0,
|
||||
msg = "OK",
|
||||
account
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user