mirror of
https://git.lewd.wtf/PGR/ascnet
synced 2025-12-13 13:54:38 +01:00
i forgor, the verify route for krsdk
This commit is contained in:
@@ -75,6 +75,38 @@ namespace AscNet.SDKServer.Controllers
|
|||||||
account
|
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
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,5 +10,8 @@ namespace AscNet.SDKServer.Models
|
|||||||
|
|
||||||
[JsonProperty("password", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty("password", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("token", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
|
public string Token { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user