danfairs / django-lazysignup

django-lazysignup is a package designed to allow users to interact with a site as if they were authenticated users, but without signing up. At any time, they can convert their temporary user account to a real user account.
BSD 3-Clause "New" or "Revised" License
410 stars 89 forks source link

Wrong user-agent check in LAZYSIGNUP_USER_AGENT_BLACKLIST for Yandex #65

Open LosYear opened 5 years ago

LosYear commented 5 years ago

django-lazysignup uses LAZYSIGNUP_USER_AGENT_BLACKLIST with default value:

DEFAULT_BLACKLIST = (
    'slurp',
    'googlebot',
    'yandex',
    'msnbot',
    'baiduspider',
)

and it works good with all search engines except Yandex. According to yandex documentation it has a lot of search bots and all of user-agents start with Yandex but this company also has own browser and search app. And on Android its user-agent looks like:

 'Mozilla/5.0 (Linux; Android 7.1.1; ONEPLUS A5000 Build/NMF26X; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/70.0.3538.110 Safari/537.36 YandexSearch/8.70/apad YandexSearchBrowser/8.70'

and contains the word Yandex. So its wrongly interpreted as search bot and the user doesn't get an authorization. I think you should replace yandex with yandexbot