示例#1
0
        private bool AreCredentialsValid(string email, string password, out User user)
        {
            user = db.Query<User>().FirstOrDefault(p => p.Email == (email).Trim());

            if (user == null) return false;

            return user.TryPassword(password);
        }
示例#2
0
        private static void SeedDatabase()
        {
            // add our admin user if it doesn't exist
            using (var session = Store.OpenSession())
            {
                if (session.Query<User>().Count(u => u.Email == "*****@*****.**") > 0) return;

                var admin = new User
                                {
                                    AspNetUserGuid = Guid.NewGuid().ToString(),
                                    Email = "*****@*****.**",
                                    Name = "Admin"
                                };
                admin.SetPassword("admin");

                session.Store(admin);
                session.SaveChanges();
            }
        }