示例#1
0
        public bool CheckOldPassword(string oldPassword, int userId)
        {
            var unitOfWork       = new UnitOfWork(new OasisContext());
            var userPasswordHash = unitOfWork.GetBaseRepository <User>().Get(userId).PasswordHash;

            return(HashPasswordHelper.VerifyHashedPassword(userPasswordHash, oldPassword));
        }
示例#2
0
        public bool IsPasswordNew(string newPassword, int userId)
        {
            var unitOfWork    = new UnitOfWork(new OasisContext());
            var userPasswords = unitOfWork.GetBaseRepository <UserPassword>().GetAll();

            return(userPasswords.All(userPassword => !HashPasswordHelper.VerifyHashedPassword(userPassword.PasswordHash, newPassword)));
        }
示例#3
0
        public bool VerifyCredentials(string userName, string password)
        {
            var unitOfWork = new UnitOfWork(new OasisContext());
            var user       = unitOfWork.GetBaseRepository <User>()
                             .GetAll(r => r.UserRoles)
                             .SingleOrDefault(r => r.UserName == userName);

            return(user != null && HashPasswordHelper.VerifyHashedPassword(user.PasswordHash, password));
        }