Bug 27060

Summary: Allow undoing changes to the password on SMTP config
Product: Koha Reporter: Tomás Cohen Arazi <tomascohen>
Component: System AdministrationAssignee: Tomás Cohen Arazi <tomascohen>
Status: Failed QA --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: gmcharlt, martin.renvoize
Version: masterKeywords: release-notes-needed
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 22343    
Bug Blocks:    
Attachments: Bug 27060: Handle password changes more robustly
Bug 27060: Handle password changes more robustly

Description Tomás Cohen Arazi 2020-11-19 18:58:40 UTC
The only way to undo changes when you are editing, is by writing the "****" string on the input. We should provide a simpler method.
Comment 1 Tomás Cohen Arazi 2020-11-19 19:00:45 UTC
Created attachment 113846 [details] [review]
Bug 27060: Handle password changes more robustly

This patch makes the changes in the password input trigger an event that
marks the password as changed. This way we don't need to compare with
the "****" string in the controller. A convenient link for restoring the
original password is added with a proper description that marks the
password as untouched, also restoring the "****" value.

To test:
1. Apply this patch
2. Have an SMTP server set
3. Open for edition
4. In paralell, have a terminal with
   $ koha-mysql kohadev
   > SELECT * FROM smtp_servers;
=> SUCCESS: The password you chose is there
5. Edit the password, save
=> SUCCESS: The password is there
6. Edit the password, choose to reset it to the one in the DB, save
=> SUCCESS: The password hasn't been changed!
7. Edit the password, put ****. save
=> SUCCESS: The password has been updated to ****
8. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 2 Martin Renvoize 2020-11-20 13:33:17 UTC
Created attachment 113881 [details] [review]
Bug 27060: Handle password changes more robustly

This patch makes the changes in the password input trigger an event that
marks the password as changed. This way we don't need to compare with
the "****" string in the controller. A convenient link for restoring the
original password is added with a proper description that marks the
password as untouched, also restoring the "****" value.

To test:
1. Apply this patch
2. Have an SMTP server set
3. Open for edition
4. In paralell, have a terminal with
   $ koha-mysql kohadev
   > SELECT * FROM smtp_servers;
=> SUCCESS: The password you chose is there
5. Edit the password, save
=> SUCCESS: The password is there
6. Edit the password, choose to reset it to the one in the DB, save
=> SUCCESS: The password hasn't been changed!
7. Edit the password, put ****. save
=> SUCCESS: The password has been updated to ****
8. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 3 Martin Renvoize 2020-11-20 13:33:53 UTC
Nice little usability enhancement here.. signing off
Comment 4 Katrin Fischer 2021-01-12 22:12:34 UTC
Hm, I think instead of "clear password changes" (which sounds like it will empty the field), "undo password changes" would be better, what do you think?

But: it doesn't always appear to work right. 

What I think it should do:
- Edit an existing SMTP server
- Change the password
- Clear the changes
- Save
- Password in the db remains unchanged

I think this happens if you only add something to the password instead of completely replacing it. I also had multiple occasions where *** appeared in the password.

To test:
- Set password to password.
- Update to password1 - hit clear icon, save.
- password in db is now: ****1

I am not sure this works right. A suggestion:
When you click into the password field, it could empty out so you have to type in the password in full.
This would also mean, that the "Undo" link would have a visual effect, right now you can't really tell if it worked.