public string PostAPIKey([FromBody] string username, string apikey)
{
if (username.IsEmpty() || apikey.IsEmpty() || GeminiApp.Config.ApiKey.IsEmpty() || string.Compare(apikey, GeminiApp.Config.ApiKey, true) != 0)
{
string response = string.Empty;
if (username.IsEmpty())
{
response = "Missing Username ";
}
if (GeminiApp.Config.ApiKey.IsEmpty())
{
response += "Web.config is missing API key ";
}
else
{
response += "Wrong API key: " + apikey + " ";
}
return response;
}
var user = UserManager.Get(username);
if (user == null)
{
return "Wrong username";
}
else
{
return user.Entity.ApiKey;
}
}