mirror of https://github.com/ppy/osu
Add 2FA verification screen to registration flow
This commit is contained in:
parent
45f60b035e
commit
a00cf87925
|
@ -0,0 +1,24 @@
|
||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Overlays.Login;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.AccountCreation
|
||||||
|
{
|
||||||
|
public partial class ScreenEmailVerification : AccountCreationScreen
|
||||||
|
{
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
InternalChild = new SecondFactorAuthForm
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Padding = new MarginPadding(20),
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,6 +5,7 @@
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.LocalisationExtensions;
|
using osu.Framework.Extensions.LocalisationExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
@ -37,6 +38,8 @@ public partial class ScreenEntry : AccountCreationScreen
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IAPIProvider api { get; set; } = null!;
|
private IAPIProvider api { get; set; } = null!;
|
||||||
|
|
||||||
|
private IBindable<APIState> apiState = null!;
|
||||||
|
|
||||||
private ShakeContainer registerShake = null!;
|
private ShakeContainer registerShake = null!;
|
||||||
private ITextPart characterCheckText = null!;
|
private ITextPart characterCheckText = null!;
|
||||||
|
|
||||||
|
@ -142,6 +145,8 @@ private void load()
|
||||||
|
|
||||||
passwordTextBox.Current.BindValueChanged(_ => updateCharacterCheckTextColour(), true);
|
passwordTextBox.Current.BindValueChanged(_ => updateCharacterCheckTextColour(), true);
|
||||||
characterCheckText.DrawablePartsRecreated += _ => updateCharacterCheckTextColour();
|
characterCheckText.DrawablePartsRecreated += _ => updateCharacterCheckTextColour();
|
||||||
|
|
||||||
|
apiState = api.State.GetBoundCopy();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateCharacterCheckTextColour()
|
private void updateCharacterCheckTextColour()
|
||||||
|
@ -221,6 +226,12 @@ private void performRegistration()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apiState.BindValueChanged(state =>
|
||||||
|
{
|
||||||
|
if (state.NewValue == APIState.RequiresSecondFactorAuth)
|
||||||
|
this.Push(new ScreenEmailVerification());
|
||||||
|
});
|
||||||
|
|
||||||
api.Login(usernameTextBox.Text, passwordTextBox.Text);
|
api.Login(usernameTextBox.Text, passwordTextBox.Text);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue