diff --git a/osu.Game.Tests/Visual/Menus/TestSceneLoginOverlay.cs b/osu.Game.Tests/Visual/Menus/TestSceneLoginOverlay.cs index 0bc71924ce..30c0f6644e 100644 --- a/osu.Game.Tests/Visual/Menus/TestSceneLoginOverlay.cs +++ b/osu.Game.Tests/Visual/Menus/TestSceneLoginOverlay.cs @@ -36,6 +36,19 @@ namespace osu.Game.Tests.Visual.Menus AddStep("show login overlay", () => loginOverlay.Show()); } + [Test] + public void TestLoginTwoFactorSuccess() + { + AddStep("logout", () => + { + API.Logout(); + ((DummyAPIAccess)API).RequireTwoFactor(); + }); + + AddStep("enter password", () => loginOverlay.ChildrenOfType().First().Text = "password"); + AddStep("submit", () => loginOverlay.ChildrenOfType().First(b => b.Text.ToString() == "Sign in").TriggerClick()); + } + [Test] public void TestLoginSuccess() { diff --git a/osu.Game/Overlays/Login/LoginForm.cs b/osu.Game/Overlays/Login/LoginForm.cs index 80dfca93d2..291e92883b 100644 --- a/osu.Game/Overlays/Login/LoginForm.cs +++ b/osu.Game/Overlays/Login/LoginForm.cs @@ -21,6 +21,11 @@ using osu.Game.Localisation; namespace osu.Game.Overlays.Login { + public partial class AccountVerificationForm : FillFlowContainer + { + + } + public partial class LoginForm : FillFlowContainer { private TextBox username = null!; diff --git a/osu.Game/Overlays/Login/LoginPanel.cs b/osu.Game/Overlays/Login/LoginPanel.cs index 71ecf2e75a..59b9c6ab9f 100644 --- a/osu.Game/Overlays/Login/LoginPanel.cs +++ b/osu.Game/Overlays/Login/LoginPanel.cs @@ -25,7 +25,7 @@ namespace osu.Game.Overlays.Login { private bool bounding = true; - private LoginForm? form; + private Drawable? form; [Resolved] private OsuColour colours { get; set; } = null!; @@ -81,6 +81,10 @@ namespace osu.Game.Overlays.Login }; break; + case APIState.RequiresAuthentication: + Child = form = new AccountVerificationForm(); + break; + case APIState.Failing: case APIState.Connecting: LinkFlowContainer linkFlow;