Bug 425036 - Change done in Users kcm is applied despite the password dialog being canceled
Summary: Change done in Users kcm is applied despite the password dialog being canceled
Status: RESOLVED FIXED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_users (show other bugs)
Version: 5.19.90
Platform: Neon Linux
: VHI normal
Target Milestone: ---
Assignee: Janet Blackquill
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2020-08-05 10:48 UTC by Patrick Silva
Modified: 2021-01-15 20:45 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.21
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Silva 2020-08-05 10:48:16 UTC
STEPS TO REPRODUCE
1. open system settings > Users
2. click on your user account
3. modify the first field
4. click on "Apply" button
5. cancel the password dialog

OBSERVED RESULT
change done in the step 3 was applied

EXPECTED RESULT
change done in the step 3 should not be applied

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.19.80
KDE Frameworks Version: 5.73.0
Qt Version: 5.14.2
Comment 1 Patrick Silva 2020-08-05 11:49:54 UTC
Also reproducible if I change the user avatar in the step 3.
Comment 2 Bug Janitor Service 2020-08-05 21:58:28 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/95
Comment 3 Bug Janitor Service 2020-09-25 13:59:58 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/163
Comment 4 David Redondo 2020-10-05 13:19:26 UTC
Git commit 05768142c17600c8d4583f171d08157ecc337390 by David Redondo.
Committed on 05/10/2020 at 13:19.
Pushed by davidre into branch 'master'.

Add some rudimentary error handling to users kcm

Don't fail silently when an error occurs otherwise the kcm just looks broken.
Show at least an inline message so the user knows that something went wrong.
The comment was wrong. We can distinguish why an error occured. Furthermore,
even if it is a permission denied error we do not know if the user canceled
the action or if it failed for some other reason so also treat that as an
error.
Related: bug 426932
FIXED-IN:5.20
CCMAIL:uhhadd@gmail.com

M  +17   -1    kcms/users/package/contents/ui/UserDetailsPage.qml
M  +13   -0    kcms/users/src/CMakeLists.txt
M  +36   -4    kcms/users/src/user.cpp
M  +12   -1    kcms/users/src/user.h
M  +2    -2    kcms/users/src/usermodel.cpp

https://invent.kde.org/plasma/plasma-desktop/commit/05768142c17600c8d4583f171d08157ecc337390
Comment 5 David Redondo 2020-10-05 13:20:19 UTC
Git commit 8500046453ae90862f72049e1a24ec804ce85cff by David Redondo.
Committed on 05/10/2020 at 13:20.
Pushed by davidre into branch 'cherry-pick-05768142'.

Add some rudimentary error handling to users kcm

Don't fail silently when an error occurs otherwise the kcm just looks broken.
Show at least an inline message so the user knows that something went wrong.
The comment was wrong. We can distinguish why an error occured. Furthermore,
even if it is a permission denied error we do not know if the user canceled
the action or if it failed for some other reason so also treat that as an
error.
Related: bug 426932
FIXED-IN:5.20
CCMAIL:uhhadd@gmail.com


(cherry picked from commit 05768142c17600c8d4583f171d08157ecc337390)

M  +17   -1    kcms/users/package/contents/ui/UserDetailsPage.qml
M  +13   -0    kcms/users/src/CMakeLists.txt
M  +36   -4    kcms/users/src/user.cpp
M  +12   -1    kcms/users/src/user.h
M  +2    -2    kcms/users/src/usermodel.cpp

https://invent.kde.org/plasma/plasma-desktop/commit/8500046453ae90862f72049e1a24ec804ce85cff
Comment 6 Patrick Silva 2020-10-09 10:24:36 UTC
it's still reproducible on neon unstable.

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.20.80
KDE Frameworks Version: 5.75.0
Qt Version: 5.15.0
Comment 7 Nate Graham 2020-10-09 17:24:02 UTC
Can confirm. We now get an error message, but the change is still applied anyway, somehow.
Comment 8 Bug Janitor Service 2021-01-15 15:31:28 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/298
Comment 9 Nate Graham 2021-01-15 20:44:40 UTC
Git commit 82b404b624d32cc3ed0bb03936455eb26b99c11d by Nate Graham, on behalf of Nicolas Fella.
Committed on 15/01/2021 at 20:44.
Pushed by ngraham into branch 'master'.

[kcm/users] Avoid half transactions when user cancels auth dialog

Not all calls to accountsservice require authentication and once we hit one that does and the user cancels the prompt then there might be some fields written already.
This is unexpected for the user since they expect the whole transaction to be cancelled.

To avoid this move the call to SetAccountType to the front since that will always trigger a prompt.

It's arguably a workaround for the lack of a transaction concept in AccountsService, but I don't see a better short-term solution.

M  +65   -56   kcms/users/src/user.cpp
M  +2    -0    kcms/users/src/user.h

https://invent.kde.org/plasma/plasma-desktop/commit/82b404b624d32cc3ed0bb03936455eb26b99c11d