VahidN / DNTCaptcha.Core

DNTCaptcha.Core is a captcha generator and validator for ASP.NET Core applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ubuntu

mina1917 opened this issue · comments

commented

Summary of the issue

In Ubuntu Linux Captcha not displaying image
I Did " Linux (and containers) support" this too.

net Core 6
ubuntu 22.04
DNTCaptcha.Core 4.3.3
image

You should checkout the server's logs and at least you should see what's the response of the requested image. Open the network's tab of the browser's developer tools and see the responses.
If you want to see the output of _logger.LogDebug, you should turn on this level of logging in the appsettings.json file.

commented

"GET /DNTCaptchaImage/Show?data=Lq3czSmPZ4-ohUzc_YK2e61LhT3DNUM1gPIaQo1mN_qo6chFrNMUkntpxoaQDfs1eYkg1FidTeKByuqmL87OGw HTTP/1.1" 400 Bad Request

commented

On my local and windows host, everthing works well but I've had problems on ubuntu linux and the image doesn't display properly

Error is : Couldn't deserialize the model.

Error is : Couldn't deserialize the model.

This means something is cutting/changing some parts of the query string and on the server, this corrupted data can't be decrypted properly. Do you have any filter here such as LowercaseQueryStrings = true?

commented

I found this in my logs :

Failed to show the captcha image.
May 30 16:59:08 localhost netcore-demo[286782]: SixLabors.Fonts.FontFamilyNotFoundException: Tahoma could not be found
May 30 16:59:08 localhost netcore-demo[286782]: at SixLabors.Fonts.FontCollection.GetImpl(String name, CultureInfo culture)
May 30 16:59:08 localhost netcore-demo[286782]: at DNTCaptcha.Core.CaptchaImageProvider.getFont(String fontName, Single fontSize) in D:\Prog\1395\DNTCaptcha.Core\src\DNTCaptcha.Core\CaptchaImageProvider.cs:line 113
May 30 16:59:08 localhost netcore-demo[286782]: at DNTCaptcha.Core.CaptchaImageProvider.DrawCaptcha(String message, String foreColor, String backColor, Single fontSize, String fontName) in D:\Prog\1395\DNTCaptcha.Core\src\DNTCaptcha.Core\CaptchaImageProvider.cs:line 53
May 30 16:59:08 localhost netcore-demo[286782]: at DNTCaptcha.Core.DNTCaptchaImageController.Show(String data) in D:\Prog\1395\DNTCaptcha.Core\src\DNTCaptcha.Core\DNTCaptchaImageController.cs:line 191

  • The last version is not using the SixLabors anymore. It's SkiaSharp.
  • Tahoma font is not installed on Linux systems. You should define a custom font here.
commented

I use this version Include="DNTCaptcha.Core" Version="4.3.3"
you mean if I use the last version, it will be fixed?

You should use a custom font for Linux systems, because they don't have the Tahoma by default.