コード例 #1
0
        public bool PasswordIsValid(MyUser user, string password)
        {
            var hasher = new MyPasswordHasher();
            var hash   = hasher.CreateHash(password);

            return(hash.Equals(user.PasswordHash));
        }
コード例 #2
0
 public async Task AddUserAsync(MyUser user, string password)
 {
     if (await UserExists(user))
     {
         throw new Exception(
             "A user with that Email address already exists");
     }
     var hasher = new MyPasswordHasher();
     user.PasswordHash = hasher.CreateHash(password).ToString();
     _db.Users.Add(user);
     await _db.SaveChangesAsync();
 }
コード例 #3
0
        public async Task AddUserAsync(MyUser user, string password)
        {
            if (await UserExists(user))
            {
                throw new Exception(
                          "A user with that Email address already exists");
            }
            var hasher = new MyPasswordHasher();

            user.PasswordHash = hasher.CreateHash(password).ToString();
            _db.Users.Add(user);
            await _db.SaveChangesAsync();
        }
コード例 #4
0
 public bool PasswordIsValid(MyUser user, string password)
 {
     var hasher = new MyPasswordHasher();
     var hash = hasher.CreateHash(password);
     return hash.Equals(user.PasswordHash);
 }