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); }
public static void UpdateUserLevel(this Account account, Account.UserLevels userLevel) { account.UserLevel = userLevel; try { SaveToDB(account); } catch (Exception e) { Logger.ErrorException(e, "UpdateUserLevel()"); } }
public DefaultCommand(Account.UserLevels minUserLevel = Account.UserLevels.User) : base("", "", minUserLevel) { }
public CommandAttribute(string command, string help, Account.UserLevels minUserLevel = Account.UserLevels.User) { this.Name = command.ToLower(); this.Help = help; this.MinUserLevel = minUserLevel; }
public CommandGroupAttribute(string name, string help, Account.UserLevels minUserLevel = Account.UserLevels.User) { this.Name = name.ToLower(); this.Help = help; this.MinUserLevel = minUserLevel; }
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); }
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)); }