mirror of
https://github.com/ppy/osu.git
synced 2024-11-14 15:17:27 +08:00
Merge pull request #26837 from bdach/2fa-not-verifying-via-link
Fix 2FA verification via link not working correctly
This commit is contained in:
commit
56700d672b
@ -29,14 +29,11 @@ namespace osu.Game.Online.Notifications.WebSocket
|
||||
|
||||
protected override async Task<PersistentEndpointClient> BuildConnectionAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
var tcs = new TaskCompletionSource<string>();
|
||||
|
||||
var req = new GetNotificationsRequest();
|
||||
req.Success += bundle => tcs.SetResult(bundle.Endpoint);
|
||||
req.Failure += ex => tcs.SetException(ex);
|
||||
api.Queue(req);
|
||||
|
||||
string endpoint = await tcs.Task.ConfigureAwait(false);
|
||||
// must use `PerformAsync()`, since we may not be fully online yet
|
||||
// (see `APIState.RequiresSecondFactorAuth` - in this state queued requests will not execute).
|
||||
await api.PerformAsync(req).ConfigureAwait(false);
|
||||
string endpoint = req.Response!.Endpoint;
|
||||
|
||||
ClientWebSocket socket = new ClientWebSocket();
|
||||
socket.Options.SetRequestHeader(@"Authorization", @$"Bearer {api.AccessToken}");
|
||||
|
@ -69,6 +69,7 @@ namespace osu.Game.Online
|
||||
break;
|
||||
|
||||
case APIState.Online:
|
||||
case APIState.RequiresSecondFactorAuth:
|
||||
await connect().ConfigureAwait(true);
|
||||
break;
|
||||
}
|
||||
@ -83,7 +84,7 @@ namespace osu.Game.Online
|
||||
|
||||
try
|
||||
{
|
||||
while (apiState.Value == APIState.Online)
|
||||
while (apiState.Value == APIState.RequiresSecondFactorAuth || apiState.Value == APIState.Online)
|
||||
{
|
||||
// ensure any previous connection was disposed.
|
||||
// this will also create a new cancellation token source.
|
||||
|
Loading…
Reference in New Issue
Block a user