Hi, i don’t know a specific way to do that but maybe the following can help.

You can create a function which delete/disable the account with if some url 
patterns are found in first name and last name

In your models add this function:

def _valid_user(s, i):
# i —> contains the user id
# s —> contains a dictionary with the user information

if any(c in s.first_name for c in ['www', 'http', 'https', '%', '/', '.']):
print('spammer user')
print('dissabling account’)

elif any(c in s.last_name for c in ['www', 'http', 'https', '%', '/', '.']):
print('spammer user')
print('dissabling account')

And this after auth declaration:

db.auth_user._after_insert.append(_valid_user)

Or maybe declaring manually the auth table with a custom validator, but I'm not 
sure if is possible…

Cheers.
Chris.

--
Sent from Canary (https://canarymail.io)

> On miércoles, may. 12, 2021 at 3:21 a. m., Manuele <[email protected] 
> (mailto:[email protected])> wrote:
> Hi!
>
> I have a quite specific question... can anyone help me to implement a
> validator that reject all text containing a URL inside?
>
> Some spammers are annoying me registering some fake account introducing
> links in registration fields such like first name, last name... I hope
> in this way to limit it. Adding Google reCaptcha v2 to the registration
> forms didn't help.
>
> Thanks a lot
>
> Manuele
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/web2py/92075f49-9036-2e9e-28d1-e045f699413d%40gmail.com.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/9ed7b2ab-e887-48f2-96b3-1cef066db7b4%40Canary.

Reply via email to