mirror of
https://github.com/ppy/osu.git
synced 2026-05-23 04:41:54 +08:00
Add two factor step to api state flow
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user