コード例 #1
0
        public IDataResult <User> Login(UserForLoginDto userForLoginDto)
        {
            var userToCheck = _userAuthService.GetByEmail(userForLoginDto.Email).Data;

            if (userToCheck == null)
            {
                return(new ErrorDataResult <User>(Messages.UserNotFound));
            }

            if (!HashingHelper.VerifyPasswordHash(userForLoginDto.Password, userToCheck.PasswordHash, userToCheck.PasswordSalt))
            {
                return(new ErrorDataResult <User>(Messages.PasswordError));
            }

            return(new SuccessDataResult <User>(userToCheck, Messages.SuccessfulLogin));
        }