mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 18:42:56 +08:00
Dispose IDisposable object before method returns
This commit is contained in:
parent
218a5f8097
commit
51a5e963bb
@ -27,42 +27,45 @@ namespace osu.Game.Online.API
|
||||
|
||||
internal bool AuthenticateWithLogin(string username, string password)
|
||||
{
|
||||
var req = new AccessTokenRequestPassword(username, password)
|
||||
using (var req = new AccessTokenRequestPassword(username, password)
|
||||
{
|
||||
Url = $@"{endpoint}/oauth/token",
|
||||
Method = HttpMethod.POST,
|
||||
ClientId = clientId,
|
||||
ClientSecret = clientSecret
|
||||
};
|
||||
|
||||
try
|
||||
})
|
||||
{
|
||||
req.BlockingPerform();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
try
|
||||
{
|
||||
req.BlockingPerform();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Token = req.ResponseObject;
|
||||
return true;
|
||||
Token = req.ResponseObject;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
internal bool AuthenticateWithRefresh(string refresh)
|
||||
{
|
||||
try
|
||||
{
|
||||
var req = new AccessTokenRequestRefresh(refresh)
|
||||
using (var req = new AccessTokenRequestRefresh(refresh)
|
||||
{
|
||||
Url = $@"{endpoint}/oauth/token",
|
||||
Method = HttpMethod.POST,
|
||||
ClientId = clientId,
|
||||
ClientSecret = clientSecret
|
||||
};
|
||||
req.BlockingPerform();
|
||||
})
|
||||
{
|
||||
req.BlockingPerform();
|
||||
|
||||
Token = req.ResponseObject;
|
||||
return true;
|
||||
Token = req.ResponseObject;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user