예제 #1
0
    private void PersistAccount(string username, string password, bool isOtp, bool isSteam)
    {
        if (App.Accounts.CurrentAccount != null && App.Accounts.CurrentAccount.UserName.Equals(username) &&
            App.Accounts.CurrentAccount.Password != password &&
            App.Accounts.CurrentAccount.SavePassword)
        {
            App.Accounts.UpdatePassword(App.Accounts.CurrentAccount, password);
        }

        if (App.Accounts.CurrentAccount == null ||
            App.Accounts.CurrentAccount.Id != $"{username}-{isOtp}-{isSteam}")
        {
            var accountToSave = new XivAccount(username)
            {
                Password               = password,
                SavePassword           = true,
                UseOtp                 = isOtp,
                UseSteamServiceAccount = isSteam
            };

            App.Accounts.AddAccount(accountToSave);

            App.Accounts.CurrentAccount = accountToSave;
        }
    }
예제 #2
0
        private void HandleLogin(bool autoLogin)
        {
            var hasValidCache = _launcher.Cache.HasValidCache(LoginUsername.Text) && App.Settings.UniqueIdCacheEnabled;

            Log.Information("CurrentAccount: {0}", _accountManager.CurrentAccount == null ? "null" : _accountManager.CurrentAccount.ToString());

            if (_accountManager.CurrentAccount != null && _accountManager.CurrentAccount.UserName.Equals(LoginUsername.Text) && _accountManager.CurrentAccount.Password != LoginPassword.Password && _accountManager.CurrentAccount.SavePassword)
            {
                _accountManager.UpdatePassword(_accountManager.CurrentAccount, LoginPassword.Password);
            }

            if (_accountManager.CurrentAccount == null || _accountManager.CurrentAccount.Id != $"{LoginUsername.Text}-{OtpCheckBox.IsChecked == true}-{SteamCheckBox.IsChecked == true}")
            {
                var accountToSave = new XivAccount(LoginUsername.Text)
                {
                    Password               = LoginPassword.Password,
                    SavePassword           = true,
                    UseOtp                 = OtpCheckBox.IsChecked == true,
                    UseSteamServiceAccount = SteamCheckBox.IsChecked == true
                };

                _accountManager.AddAccount(accountToSave);

                _accountManager.CurrentAccount = accountToSave;
            }

            if (!autoLogin)
            {
                App.Settings.AutologinEnabled = AutoLoginCheckBox.IsChecked == true;
            }

            var otp = "";

            if (OtpCheckBox.IsChecked == true && !hasValidCache)
            {
                var otpDialog = new OtpInputDialog();
                otpDialog.ShowDialog();

                if (otpDialog.Result == null)
                {
                    _isLoggingIn = false;

                    if (autoLogin)
                    {
                        CleanUp();
                        Environment.Exit(0);
                    }

                    return;
                }

                otp = otpDialog.Result;
            }

            HandleBootCheck(() => this.Dispatcher.Invoke(() => StartLogin(otp)));
        }
예제 #3
0
    private void SwitchAccount(XivAccount account, bool saveAsCurrent)
    {
        this.loginFrame.Username    = account.UserName;
        this.loginFrame.IsOtp       = account.UseOtp;
        this.loginFrame.IsSteam     = account.UseSteamServiceAccount;
        this.loginFrame.IsAutoLogin = App.Settings.IsAutologin ?? false;

        if (account.SavePassword)
        {
            this.loginFrame.Password = account.Password;
        }

        if (saveAsCurrent)
        {
            App.Accounts.CurrentAccount = account;
        }
    }
예제 #4
0
        private void SwitchAccount(XivAccount account, bool saveAsCurrent)
        {
            LoginUsername.Text          = account.UserName;
            OtpCheckBox.IsChecked       = account.UseOtp;
            SteamCheckBox.IsChecked     = account.UseSteamServiceAccount;
            AutoLoginCheckBox.IsChecked = App.Settings.AutologinEnabled;

            if (account.SavePassword)
            {
                LoginPassword.Password = account.Password;
            }

            if (saveAsCurrent)
            {
                _accountManager.CurrentAccount = account;
            }
        }
        private void SwitchAccount(XivAccount account, bool saveAsCurrent)
        {
            Model.Username    = account.UserName;
            Model.IsOtp       = account.UseOtp;
            Model.IsSteam     = account.UseSteamServiceAccount;
            Model.IsAutoLogin = App.Settings.AutologinEnabled;

            if (account.SavePassword)
            {
                LoginPassword.Password = account.Password;
            }

            if (saveAsCurrent)
            {
                _accountManager.CurrentAccount = account;
            }
        }
        private void SwitchAccount(XivAccount account, bool saveAsCurrent)
        {
            LoginUsername.Text          = account.UserName;
            OtpCheckBox.IsChecked       = account.UseOtp;
            SteamCheckBox.IsChecked     = account.UseSteamServiceAccount;
            AutoLoginCheckBox.IsChecked = Settings.IsAutologin();

            if (account.SavePassword)
            {
                LoginPassword.Password = account.Password;
            }

            if (saveAsCurrent)
            {
                Properties.Settings.Default.CurrentAccount = account.Id;
                Properties.Settings.Default.Save();
            }
        }
예제 #7
0
 private void AccountSwitcherOnAccountChanged(object?sender, XivAccount e)
 {
     SwitchAccount(e, true);
 }
예제 #8
0
 private void OnAccountSwitchedEventHandler(object sender, XivAccount e)
 {
     SwitchAccount(e, true);
 }
예제 #9
0
        private void HandleLogin(bool autoLogin)
        {
            if (_accountManager.CurrentAccount != null && _accountManager.CurrentAccount.UserName.Equals(LoginUsername.Text) && _accountManager.CurrentAccount.Password != LoginPassword.Password && _accountManager.CurrentAccount.SavePassword)
            {
                _accountManager.UpdatePassword(_accountManager.CurrentAccount, LoginPassword.Password);
            }

            if (_accountManager.CurrentAccount == null || _accountManager.CurrentAccount.Id != $"{LoginUsername.Text}-{OtpCheckBox.IsChecked == true}-{SteamCheckBox.IsChecked == true}")
            {
                var accountToSave = new XivAccount(LoginUsername.Text)
                {
                    Password               = LoginPassword.Password,
                    SavePassword           = true,
                    UseOtp                 = OtpCheckBox.IsChecked == true,
                    UseSteamServiceAccount = SteamCheckBox.IsChecked == true
                };

                _accountManager.AddAccount(accountToSave);

                _accountManager.CurrentAccount = accountToSave;
            }

            if (!autoLogin)
            {
                if (AutoLoginCheckBox.IsChecked == true)
                {
                    var result = MessageBox.Show(
                        "This option will log you in automatically with the credentials you entered.\nTo reset it again, launch this application while holding the Shift key.\n\nDo you really want to enable it?",
                        "Enabling Autologin", MessageBoxButton.YesNo);

                    if (result == MessageBoxResult.No)
                    {
                        AutoLoginCheckBox.IsChecked = false;
                    }
                }
                else
                {
                    AutoLoginCheckBox.IsChecked = false;
                }

                _setting.AutologinEnabled = AutoLoginCheckBox.IsChecked == true;
            }

            _setting.Save();

            var otp = "";

            if (OtpCheckBox.IsChecked == true)
            {
                var otpDialog = new OtpInputDialog();
                otpDialog.ShowDialog();

                if (otpDialog.Result == null)
                {
                    _isLoggingIn = false;

                    if (autoLogin)
                    {
                        Environment.Exit(0);
                    }

                    return;
                }

                otp = otpDialog.Result;
            }

            StartGame(otp);
        }
        private void HandleLogin(bool autoLogin, bool startGame = true)
        {
            if (string.IsNullOrEmpty(LoginUsername.Text))
            {
                CustomMessageBox.Show(
                    Loc.Localize("EmptyUsernameError", "Please enter an username."),
                    "XIVLauncher", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            if (string.IsNullOrEmpty(LoginPassword.Password))
            {
                CustomMessageBox.Show(
                    Loc.Localize("EmptyPasswordError", "Please enter a password."),
                    "XIVLauncher", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            if (_isLoggingIn)
            {
                return;
            }

            if (Repository.Ffxiv.GetVer(App.Settings.GamePath) == PatcherMain.BASE_GAME_VERSION && App.Settings.UniqueIdCacheEnabled)
            {
                CustomMessageBox.Show(
                    Loc.Localize("UidCacheInstallError",
                                 "You enabled the UID cache in the patcher settings.\nThis setting does not allow you to reinstall FFXIV.\n\nIf you want to reinstall FFXIV, please take care to disable it first."),
                    "XIVLauncher Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            _isLoggingIn = true;

            var hasValidCache = UniqueIdCache.Instance.HasValidCache(LoginUsername.Text) && App.Settings.UniqueIdCacheEnabled;

            Log.Information("CurrentAccount: {0}", _accountManager.CurrentAccount == null ? "null" : _accountManager.CurrentAccount.ToString());

            if (_accountManager.CurrentAccount != null && _accountManager.CurrentAccount.UserName.Equals(LoginUsername.Text) && _accountManager.CurrentAccount.Password != LoginPassword.Password && _accountManager.CurrentAccount.SavePassword)
            {
                _accountManager.UpdatePassword(_accountManager.CurrentAccount, LoginPassword.Password);
            }

            if (_accountManager.CurrentAccount == null || _accountManager.CurrentAccount.Id != $"{LoginUsername.Text}-{OtpCheckBox.IsChecked == true}-{SteamCheckBox.IsChecked == true}")
            {
                var accountToSave = new XivAccount(LoginUsername.Text)
                {
                    Password               = LoginPassword.Password,
                    SavePassword           = true,
                    UseOtp                 = OtpCheckBox.IsChecked == true,
                    UseSteamServiceAccount = SteamCheckBox.IsChecked == true
                };

                _accountManager.AddAccount(accountToSave);

                _accountManager.CurrentAccount = accountToSave;
            }

            if (!autoLogin)
            {
                App.Settings.AutologinEnabled = AutoLoginCheckBox.IsChecked == true;
            }

            var otp = "";

            if (OtpCheckBox.IsChecked == true && !hasValidCache)
            {
                var otpDialog = new OtpInputDialog();
                otpDialog.ShowDialog();

                if (otpDialog.Result == null)
                {
                    _isLoggingIn = false;

                    if (autoLogin)
                    {
                        CleanUp();
                        Environment.Exit(0);
                    }

                    return;
                }

                otp = otpDialog.Result;
            }

            HandleBootCheck(() => this.Dispatcher.Invoke(() => StartLogin(otp, startGame)));
        }
 public ProfilePictureInputWindow(XivAccount account)
 {
     InitializeComponent();
 }
        public ProfilePictureInputWindow(XivAccount account)
        {
            InitializeComponent();

            DataContext = new ProfilePictureInputWindowViewModel();
        }
 public AccountSwitcherEntry(XivAccount account)
 {
     this.Account = account;
 }