> For the complete documentation index, see [llms.txt](https://documentation.opencats.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.opencats.org/how-tos/password-resets.md).

# Password resets

OpenCATS stores passwords with PHP `password_hash()` and verifies them with `password_verify()`. Older installations may still contain legacy hashes that OpenCATS migrates after successful login.

## Preferred reset method

When possible, have an administrator reset the user's password from inside OpenCATS. This avoids direct database edits and ensures the new password is stored with the current hashing method.

## Emergency database reset

If you are locked out and must reset a password directly in MariaDB, do **not** use MD5. Generate a modern PHP password hash first.

On a server with PHP 7.4 available:

```bash
php -r "echo password_hash('NewStrongPasswordHere', PASSWORD_DEFAULT), PHP_EOL;"
```

Copy the generated hash. Then update the relevant user record in the OpenCATS database using phpMyAdmin or the MariaDB CLI. The exact user table and user ID depend on your installation, so make a database backup before changing anything.

Example CLI workflow:

```bash
mysqldump -u opencats -p opencats > before-password-reset.sql
mysql -u opencats -p opencats
```

Then inspect the users table, identify the correct account, and update only that account's password field with the generated hash.

## Security notes

* Do not store or share the temporary password in tickets, chat, or email.
* Require the user to change the password after login.
* Keep the pre-reset database backup only as long as required and protect it because it contains personal data and password hashes.
* If LDAP authentication is enabled, reset the password in the LDAP directory instead of the OpenCATS database.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://documentation.opencats.org/how-tos/password-resets.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
