go-vikunja / vikunja

Mirror of vikunja from https://code.vikunja.io/api
GNU Affero General Public License v3.0
773 stars 56 forks source link

Resetting user preferences during login #102

Closed liamgilbey closed 6 months ago

liamgilbey commented 6 months ago

Description

I have an issue where Vikjuna is resetting user preferences when they login.

I have setup Vikjuna with OIDC integration handled by Authelia, and I can successfully login and update user preferences. My setup is with MariaDB, and I can confirm a value in the database is updated when a user preference is changed.

image

However, if that users logs out and in again, that preference is gone

image

I've reviewed the MariaDB logs and I can see the following happening:


UPDATE `users` SET `name` = '<user>', `username` = '<username>', `email` = '<email>', `avatar_provider` = '', `avatar_file_id` = 0, `email_reminders_enabled` = 0, `discoverable_by_name` = 0, `discoverable_by_email` = 0, `overdue_tasks_reminders_enabled` = 0, `overdue_tasks_reminders_time` = '9:00', `default_project_id` = 0, `week_start` = 0, `language` = 'en', `timezone` = 'Pacific/Auckland', `frontend_settings` = '{\"color_schema\":\"auto\",\"play_sound_when_done\":true,\"quick_add_magic_mode\":\"vikunja\"}', `updated` = '2023-12-22 17:34:54' WHERE `id`=1

It's as if every time a user logs on, the api is treating them like a new user.

Vikunja Frontend Version

0.22.0

Vikunja API Version

0.22.0

Browser and version

No response

Can you reproduce the bug on the Vikunja demo site?

No

Screenshots

No response

kolaente commented 6 months ago

It's as if every time a user logs on, the api is treating them like a new user.

Can you verify if the user is created on every login?

liamgilbey commented 6 months ago

From the database perspective, it's not. I can see the user list is not growing, and instead the record has all attributes reset as in the SQL query above. I can also see the created column stays the same, but the updated column is updated with the timestamp of the login

kolaente commented 6 months ago

Looks like this only happened when the user's name or email had changed in the external auth provider.

Should be fixed in a5a6aba7c80618a45bb57616c7378917675cadab. Please check with the next unstable build if your problem went away.

liamgilbey commented 6 months ago

I can confirm that works nicely - thank you