Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

login case sensitivity and user home issue #56

Open
Stratop0w opened this issue Jul 8, 2024 · 1 comment
Open

login case sensitivity and user home issue #56

Stratop0w opened this issue Jul 8, 2024 · 1 comment

Comments

@Stratop0w
Copy link

Hi,

I'm preparing to switch to NC 29 and the external user extention I previously used is not supported anymore, so I tried user_backend_sql_raw as a replacement.

It sounds very good, except that an issue with login sensitivity: if I log with a name like 'foo' or 'Foo', login will succeed, like this should, but then, the two logins will then have different homes, which is the issue.

With internal Nextcloud user login or other external authentication apps I experimented, case sensitivity never caused this issue.

Best regards,
Strato

AVee added a commit to AVee/user_backend_sql_raw that referenced this issue Sep 14, 2024
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 PanCakeConnaisseur#56
@bob4os
Copy link

bob4os commented Oct 25, 2024

I set my SQL statements like this:

'get_password_hash_for_user' => 'SELECT password FROM users WHERE LOWER(username) = LOWER(:username)',
'set_password_hash_for_user' => 'UPDATE users SET password = :new_password_hash WHERE LOWER(username) = LOWER(:username)',
'user_exists' => 'SELECT EXISTS(SELECT 1 FROM users WHERE LOWER(username) = LOWER(:username))',
'get_users' => 'SELECT username FROM users WHERE (LOWER(username) LIKE LOWER(:search)) OR (LOWER(displayname) LIKE LOWER(:search))',
'get_display_name' => 'SELECT displayname FROM users WHERE LOWER(username) = LOWER(:username)',
'set_display_name' => 'UPDATE users SET displayname = :new_display_name WHERE LOWER(username) = LOWER(:username))',
'count_users' => 'SELECT COUNT(*) FROM users',
'delete_user' => 'SELECT EXISTS(SELECT 1 FROM users WHERE LOWER(username) = LOWER(:username))',
'create_user' => 'INSERT INTO users (username, password) VALUES (:username, :password_hash)',

and created a fork to solve this issue for me.
Nextcloud uses the IGetRealUIDBackend for this.

However, I no longer use this app in production.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants