Merge pull request #13991 from peppy/fix-authentication-failure-unhandled

Fix authentication loss not handled correctly
This commit is contained in:
Dan Balasescu 2021-07-24 00:43:06 +09:00 committed by GitHub
commit 6621da6752
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -148,6 +148,16 @@ namespace osu.Game.Online.API
var userReq = new GetUserRequest();
userReq.Failure += ex =>
{
if (ex.InnerException is WebException webException && webException.Message == @"Unauthorized")
{
log.Add(@"Login no longer valid");
Logout();
}
else
failConnectionProcess();
};
userReq.Success += u =>
{
localUser.Value = u;
@ -167,6 +177,7 @@ namespace osu.Game.Online.API
// getting user's friends is considered part of the connection process.
var friendsReq = new GetFriendsRequest();
friendsReq.Failure += _ => failConnectionProcess();
friendsReq.Success += res =>
{
friends.AddRange(res);