1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-23 06:23:47 +08:00

Add two factor step to api state flow

This commit is contained in:
Dean Herbert
2023-11-15 20:00:09 +09:00
Unverified
parent 87a76b9ee8
commit 85e303ec54
2 changed files with 15 additions and 1 deletions
+5
View File
@@ -540,6 +540,11 @@ namespace osu.Game.Online.API
/// </summary>
Failing,
/// <summary>
/// Waiting on second factor authentication.
/// </summary>
RequiresAuthentication,
/// <summary>
/// We are in the process of (re-)connecting.
/// </summary>
+10 -1
View File
@@ -55,6 +55,7 @@ namespace osu.Game.Online.API
private bool shouldFailNextLogin;
private bool stayConnectingNextLogin;
private bool requiresTwoFactor;
/// <summary>
/// The current connectivity state of the API.
@@ -115,7 +116,13 @@ namespace osu.Game.Online.API
Id = DUMMY_USER_ID,
};
state.Value = APIState.Online;
if (requiresTwoFactor)
{
state.Value = APIState.RequiresAuthentication;
requiresTwoFactor = false;
}
else
state.Value = APIState.Online;
}
public void Logout()
@@ -142,6 +149,8 @@ namespace osu.Game.Online.API
IBindableList<APIUser> IAPIProvider.Friends => Friends;
IBindable<UserActivity> IAPIProvider.Activity => Activity;
public void RequireTwoFactor() => requiresTwoFactor = true;
/// <summary>
/// During the next simulated login, the process will fail immediately.
/// </summary>