Ejemplo n.º 1
0
 public ConfirmPasswordWindow(UserInfoModel user, SettingsWindow settingsWindow)
 {
     InitializeComponent();
     signIn          = new SignInMethods();
     _settingsWindow = settingsWindow;
     _user           = user;
 }
Ejemplo n.º 2
0
        public bool TrySignInAccount(SignInMethods signInMethod, string username, string password)
        {
            if (!string.IsNullOrEmpty(username))
            {
                foreach (Account Account in Accounts)
                {
                    if (Account.Username == username)
                    {
                        if (signInMethod == SignInMethods.None || signInMethod == Account.SignInMethod)
                        {
                            if ((Account.SignInMethod == SignInMethods.NameOnly && string.IsNullOrEmpty(password)) || (Account.SignInMethod == SignInMethods.NameAndPassword && password == Account.Password))
                            {
                                SignedInAccount        = Account;
                                IsPasswordInvalidError = false;
                                return(true);
                            }
                        }

                        break;
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 3
0
 public Account(string email, SignInMethods signInMethod, string username, string password)
 {
     Email           = email;
     SignInMethod    = signInMethod;
     Username        = username;
     Password        = (signInMethod == SignInMethods.NameAndPassword ? password : null);
     KeepActiveIndex = -1;
 }
Ejemplo n.º 4
0
        private void On_SignInWithMethod(SignInMethods signInMethod, PageNames pageName, out PageNames destinationPageName)
        {
            string TempPassword = Password;

            Password = null;
            NotifyPropertyChanged(nameof(Password));

            if (((AccountManager)GetAccountManager).TrySignInAccount(signInMethod, Name, TempPassword))
            {
                CompleteSignIn(pageName, out destinationPageName);
            }
            else
            {
                FailSignIn(out destinationPageName);
            }
        }
Ejemplo n.º 5
0
        public SignInError TryAddAccount(string email, SignInMethods method, string username, string password, out Account account)
        {
            if (string.IsNullOrEmpty(email) || !(method == SignInMethods.NameOnly || method == SignInMethods.NameAndPassword) || string.IsNullOrEmpty(username) || (method == SignInMethods.NameAndPassword && string.IsNullOrEmpty(password)))
            {
                account = null;
                return(SignInError.InternalError);
            }

            foreach (Account Account in Accounts)
            {
                if (Account.Username == username)
                {
                    account = null;
                    return(SignInError.NameAlreadyInUse);
                }
            }

            account = new Account(email, method, username, password);
            Accounts.Add(account);

            return(SignInError.None);
        }
Ejemplo n.º 6
0
 public SignInWindow()
 {
     InitializeComponent();
     signInMethods = new SignInMethods();
 }