Recent

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

wp

  • Hero Member
  • *****
  • Posts: 8881
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.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 757
  • 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 2.3.0(trunk) FPC 3.3.1(trunk) Ubuntu 21.04 64b Dark Theme
Lazarus 2.0.12(stable) FPC 3.2.2(stable) Ubuntu 21.04 64b Dark Theme
http://github.com/gcarreno

CM630

  • Hero Member
  • *****
  • Posts: 964
  • Не съм сигурен, че те разбирам.
    • 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 »
Лазар 2,2,0RC1 32 bit; FPC3,2,2; rev 65419 on W10 64bit.

wp

  • Hero Member
  • *****
  • Posts: 8881
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;
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

 

TinyPortal © 2005-2018