user_backend_sql_raw icon indicating copy to clipboard operation
user_backend_sql_raw copied to clipboard

Support setting the uid from the query

Open AVee opened this issue 5 months ago • 1 comments

Extend the get_password_hash_for_user query to allow it to return the uid as well. This makes it possible to support normalizing usernames, using email as username and other types of mapping in the query.

Probably deals with #56

I personally needed this to support both username and email as login without nextcloud creating separate accounts for 'user' and 'user@domain'. There certainly are different ways to solve this, I choose to use the optional second column in get_password_hash_for_user as that would be backwards compatible with exiting configurations. But a specific configuration for this could also be an option.

The checkPassword function is intended to be used this way, see https://github.com/nextcloud/server/blob/master/lib/public/User/Backend/ICheckPasswordBackend.php

AVee avatar Sep 14 '24 21:09 AVee