示例#1
0
        public UserDataPW(BaseUserDataPw data)
        {
            id        = data.id;
            discordId = data.discordId;

            completedTournaments = new List <CompletedTournaments>();
            ongoingTournaments   = new List <CompletedTournaments>();

            ongoingCreatedTournaments   = new List <CompletedTournaments>();
            completedCreatedTournaments = new List <CompletedTournaments>();
            salt = CryptographyModule.GenerateSalt();
            hash = CryptographyModule.GenerateHash(data.password, salt);
        }
示例#2
0
        public static async Task <bool> CreateUser(BaseUserDataPw value)
        {
            var collec = Models.DatabaseConnection.GetDb().GetCollection <UserDataPW>("UserData");
            var user   = (await collec.FindAsync(u => u.id == value.id.ToLower())).FirstOrDefault();

            if (user == null)
            {
                value.id = value.id.ToLower();
                await collec.InsertOneAsync(new UserDataPW(value));

                return(true);
            }
            else
            {
                return(false);
            }
        }