Recent

Author Topic: Lazarus implementation of a CAPTCHA  (Read 6506 times)

wp

  • Hero Member
  • *****
  • Posts: 11854
Re: Lazarus implementation of a CAPTCHA
« Reply #15 on: September 20, 2021, 06:35:49 pm »
The catcha component (https://github.com/wp-xyz/captcha_component) is UTF8-aware now, and the list of valid characters is exposed as properties UppercaseChars, LowercaseChars, NumericChars and CustomChars. Just replace them with kyrillic or whatever. Please report back if it's working (just tested the German umlauts, and they work).

Please note that I renamed some identifiers.

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1111
  • Professional amateur ;-P
Re: Lazarus implementation of a CAPTCHA
« Reply #16 on: September 20, 2021, 06:45:59 pm »
Hey CM630,

Looks like you've got your wish come true.

According to WP's post above, you're now able to use Cyrillic to your heart's content.

@WP: Thank mate, you da man!!

Cheers,
Gus
Lazarus 3.99(main) FPC 3.3.1(main) Ubuntu 23.10 64b Dark Theme
Lazarus 3.0.0(stable) FPC 3.2.2(stable) Ubuntu 23.10 64b Dark Theme
http://github.com/gcarreno

CM630

  • Hero Member
  • *****
  • Posts: 1081
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Lazarus implementation of a CAPTCHA
« Reply #17 on: September 21, 2021, 07:48:07 am »
I have tried @WP's solution, it works with kirrilic, but should not function Verify(const AText: String): Boolean; rather be function Verify(const AText: String; IgnoreCase: boolean): Boolean; ?
For some letters for an end-user, it might be impossible to tell which character is lowercase and which one is uppercase.


Looks like you've got your wish come true.

Just testing  :D , actually I am not sure if I can use this somehow.
« Last Edit: September 21, 2021, 08:07:58 am by CM630 »
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

wp

  • Hero Member
  • *****
  • Posts: 11854
Re: Lazarus implementation of a CAPTCHA
« Reply #18 on: September 21, 2021, 11:26:48 am »
should not function Verify(const AText: String): Boolean; rather be function Verify(const AText: String; IgnoreCase: boolean): Boolean; ?
For some letters for an end-user, it might be impossible to tell which character is lowercase and which one is uppercase.
This sounds like requesting a complicated password with uppercase and lowercase characters and then checking its validity only with ignorecase...

If uppercase and lowercase characters are too similar in your language then I'd select only one of them in the Options of the component. Or, since Verify compares only strings, you could simply build it yourself:
Code: Pascal  [Select][+][-]
  1. uses
  2.   LazUTF8;
  3.  
  4. function TForm1.VerifyCaptcha(AText: String): boolean;
  5. begin
  6.   Result := UTF8Lowercase(Captcha1.Text) = UTF8Lowercase(AText);
  7. end;

 

TinyPortal © 2005-2018