Example #1
0
        public static Account CreateAccount(string email, string password, Account.UserLevels userLevel = Account.UserLevels.User)
        {
            var account = new Account(email, password, userLevel);

            Accounts.Add(email, account);
            account.SaveToDB();

            return(account);
        }
Example #2
0
 public static void UpdateUserLevel(this Account account, Account.UserLevels userLevel)
 {
     account.UserLevel = userLevel;
     try
     {
         SaveToDB(account);
     }
     catch (Exception e)
     {
         Logger.ErrorException(e, "UpdateUserLevel()");
     }
 }
Example #3
0
 public DefaultCommand(Account.UserLevels minUserLevel = Account.UserLevels.User)
     : base("", "", minUserLevel)
 {
 }
Example #4
0
 public CommandAttribute(string command, string help, Account.UserLevels minUserLevel = Account.UserLevels.User)
 {
     this.Name         = command.ToLower();
     this.Help         = help;
     this.MinUserLevel = minUserLevel;
 }
Example #5
0
 public CommandGroupAttribute(string name, string help, Account.UserLevels minUserLevel = Account.UserLevels.User)
 {
     this.Name         = name.ToLower();
     this.Help         = help;
     this.MinUserLevel = minUserLevel;
 }
Example #6
0
 public CommandAttribute(string command, string help, Account.UserLevels minUserLevel = Account.UserLevels.User)
 {
     this.Name = command.ToLower();
     this.Help = help;
     this.MinUserLevel = minUserLevel;
 }
Example #7
0
 public CommandGroupAttribute(string name, string help, Account.UserLevels minUserLevel = Account.UserLevels.User)
 {
     this.Name = name.ToLower();
     this.Help = help;
     this.MinUserLevel = minUserLevel;
 }
Example #8
0
        public static Account CreateAccount(string email, string password, string battleTag, Account.UserLevels userLevel = Account.UserLevels.User)
        {
            var hashCode = AccountManager.GetUnusedHashCodeForBattleTag(battleTag);
            var account  = new Account(email, password, battleTag, hashCode, userLevel);

            Accounts.Add(email, account);
            account.SaveToDB();

            return(account);
        }
Example #9
0
        public static Account CreateAccount(string email, string password, string battleTag, Account.UserLevels userLevel = Account.UserLevels.User)
        {
            if (password.Length > 16)
            {
                password = password.Substring(0, 16);                       // make sure the password does not exceed 16 chars.
            }
            var hashCode         = GetRandomHashCodeForBattleTag();
            var salt             = SRP6a.GetRandomBytes(32);
            var passwordVerifier = SRP6a.CalculatePasswordVerifierForAccount(email, password, salt);


            var newDBAccount = new DBAccount
            {
                Email            = email,
                Salt             = salt,
                PasswordVerifier = passwordVerifier,
                BattleTagName    = battleTag,
                UserLevel        = userLevel,
                HashCode         = hashCode
            };


            DBSessions.AccountSession.SaveOrUpdate(newDBAccount);
            DBSessions.AccountSession.Flush();

            return(GetAccountByDBAccount(newDBAccount));
        }