Add function to fetch user by email address #1737

Closed
opened 2026-04-06 02:18:17 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @mittler-works on 2/20/2023

In my opinion, as an admin, it is nice to be able to find users by email address as well. This makes Vaultwarden more compatible with other systems (e.g. for user management). Currently I use the get_users_json route to fetch all users and then filter the result, but this is suboptimal as the number of users grows.

The user model already provides a corresponding function (here), I just added a route in the admin controller to call this function.

Just as /users/overview, /users/by-mail/<mail> should not conflict with /users/<uuid>.

*Originally created by @mittler-works on 2/20/2023* In my opinion, as an admin, it is nice to be able to find users by email address as well. This makes Vaultwarden more compatible with other systems (e.g. for user management). Currently I use the `get_users_json` route to fetch all users and then filter the result, but this is suboptimal as the number of users grows. The user model already provides a corresponding function ([here](https://github.com/dani-garcia/vaultwarden/blob/main/src/db/models/user.rs#L362-L371)), I just added a route in the admin controller to call this function. Just as `/users/overview`, `/users/by-mail/<mail>` should not conflict with `/users/<uuid>`.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/vaultwarden#1737