mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 12:35:34 +08:00
clear remembered username when checkbox is unticked
This commit is contained in:
parent
901bb01f57
commit
d01421b951
@ -13,11 +13,11 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Localisation;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Overlays.Settings;
|
using osu.Game.Overlays.Settings;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osu.Game.Localisation;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Login
|
namespace osu.Game.Overlays.Login
|
||||||
{
|
{
|
||||||
@ -26,6 +26,7 @@ namespace osu.Game.Overlays.Login
|
|||||||
private TextBox username = null!;
|
private TextBox username = null!;
|
||||||
private TextBox password = null!;
|
private TextBox password = null!;
|
||||||
private ShakeContainer shakeSignIn = null!;
|
private ShakeContainer shakeSignIn = null!;
|
||||||
|
private SettingsCheckbox rememberUsername = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IAPIProvider api { get; set; } = null!;
|
private IAPIProvider api { get; set; } = null!;
|
||||||
@ -82,7 +83,7 @@ namespace osu.Game.Overlays.Login
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
new SettingsCheckbox
|
rememberUsername = new SettingsCheckbox
|
||||||
{
|
{
|
||||||
LabelText = LoginPanelStrings.RememberUsername,
|
LabelText = LoginPanelStrings.RememberUsername,
|
||||||
Current = config.GetBindable<bool>(OsuSetting.SaveUsername),
|
Current = config.GetBindable<bool>(OsuSetting.SaveUsername),
|
||||||
@ -130,6 +131,7 @@ namespace osu.Game.Overlays.Login
|
|||||||
forgottenPasswordLink.AddLink(LayoutStrings.PopupLoginLoginForgot, $"{api.WebsiteRootUrl}/home/password-reset");
|
forgottenPasswordLink.AddLink(LayoutStrings.PopupLoginLoginForgot, $"{api.WebsiteRootUrl}/home/password-reset");
|
||||||
|
|
||||||
password.OnCommit += (_, _) => performLogin();
|
password.OnCommit += (_, _) => performLogin();
|
||||||
|
rememberUsername.SettingChanged += () => onRememberUsernameChanged(config);
|
||||||
|
|
||||||
if (api.LastLoginError?.Message is string error)
|
if (api.LastLoginError?.Message is string error)
|
||||||
{
|
{
|
||||||
@ -146,6 +148,12 @@ namespace osu.Game.Overlays.Login
|
|||||||
shakeSignIn.Shake();
|
shakeSignIn.Shake();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onRememberUsernameChanged(OsuConfigManager config)
|
||||||
|
{
|
||||||
|
if (rememberUsername.Current.Value == false)
|
||||||
|
config.SetValue(OsuSetting.Username, string.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e) => true;
|
protected override bool OnClick(ClickEvent e) => true;
|
||||||
|
|
||||||
protected override void OnFocus(FocusEvent e)
|
protected override void OnFocus(FocusEvent e)
|
||||||
|
Loading…
Reference in New Issue
Block a user