How to identify and reset all users blocked by CAPTCHA.
The content on this page relates to platforms which are supported; however, the content is out of scope of our Atlassian Support Offerings. Consequently, Atlassian cannot guarantee support. Please be aware that this material is provided for your information only and you may use it at your own risk.
Purpose
If you are troubleshooting problems with CAPTCHA in Bitbucket you may want to find all users who are being blocked and reset them.
Solution
To Identify the users who are blocked by the CAPTCHA requirement you can run a query like the following:
SELECT us.user_name
FROM cwd_user_attribute as atr
JOIN cwd_user as us ON atr.user_id=us.id
WHERE atr.attribute_name = "failedAuthenticationAttemptCount" AND atr.attribute_value >= 5 ;
If it's only a few users you can reset the CAPTCHA individually or script something with the list of users you got from the database query. Here's an example curl request to reset a user's CAPTCHA.
curl --user <user_name>:<password> -X DELETE http://baseurl:7990/rest/api/1.0/admin/users/captcha?name=<user_name>
Please note that you'll have to replace the authenticating username and password as well as the base URL and the target user who's CAPTCHA needs to be cleared.
To reset CAPTCHA for all users you would have to make manual modifications to the database:
- Backup Bitbucket
- Stop Bitbucket
- Run an UPDATE like the following:
UPDATE cwd_user_attribute
SET attribute_value = 0, attribute_lower_value = 0
WHERE attribute_name = 'failedAuthenticationAttemptCount';
- Restart Bitbucket
Please make sure you backup Bitbucket before you make any modifications to the database.