Example #1
0
        public AuthResponse AuthPassword2(string login, string password2, ref Account account)
        {
            AuthResponse result;

            result = AuthResponse.WrongInfo;

            account = MdbAccount.GetInstance().GetAccountByName(login);

            if (account != null)
            {
                if (account.Password2 == null)
                {
                    account.Name = login;
                    account.Password2 = password2;
                    MdbAccount.GetInstance().UpdateAccount(account);
                    result = AuthResponse.Success;
                }
                else
                {
                    if (account.Password2 == password2)
                        result = AuthResponse.Success;
                    else
                        result = AuthResponse.WrongInfo;
                }
            }
            return result;
        }
Example #2
0
        public AuthResponse AuthAccount(string login, string password, ref Account account)
        {
            AuthResponse result;

            account = MdbAccount.GetInstance().GetAccountByName(login);

            if (account != null)
            {
                if (account.Password == password)
                    result = AuthResponse.Success;
                else
                    result = AuthResponse.WrongInfo;
            }
            else
            {
                if (Configuration.Setting.AutoAccount)
                {
                    account = new Account()
                    {
                        Name = login,
                        Password = password,
                        Password2 = null,
                        LastAddress = "0.0.0.0",
                    };
                    MdbAccount.GetInstance().AddAccount(account);
                    result = AuthResponse.Success;
                }
                else
                    result = AuthResponse.WrongInfo;
            }

            return result;
        }
Example #3
0
 public void UpdateAccount(Account acc)
 {
     var query = Query<Account>.EQ(e => e.Id, acc.Id);
     //
     var update = Update<Account>
                     .Set(e => e.Password2, acc.Password2) // update modifiers
                     .Set(e => e.LastAddress, acc.LastAddress); // update modifiers
     m_Collection.Update(query, update);
 }
Example #4
0
 public void AddAccount(Account acc)
 {
     m_Collection.Insert(acc);
 }