Bugzilla – Attachment 113881 Details for
Bug 27060
Allow undoing changes to the password on SMTP config
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27060: Handle password changes more robustly
Bug-27060-Handle-password-changes-more-robustly.patch (text/plain), 3.86 KB, created by
Martin Renvoize (ashimema)
on 2020-11-20 13:33:17 UTC
(
hide
)
Description:
Bug 27060: Handle password changes more robustly
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-11-20 13:33:17 UTC
Size:
3.86 KB
patch
obsolete
>From 7a24fc3c4955054890942e041e58ad806373bdcd Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 19 Nov 2020 15:54:04 -0300 >Subject: [PATCH] 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> >--- > admin/smtp_servers.pl | 5 +++-- > .../prog/en/modules/admin/smtp_servers.tt | 13 ++++++++++++- > 2 files changed, 15 insertions(+), 3 deletions(-) > >diff --git a/admin/smtp_servers.pl b/admin/smtp_servers.pl >index 19458a23a4..d23f98673d 100755 >--- a/admin/smtp_servers.pl >+++ b/admin/smtp_servers.pl >@@ -123,10 +123,11 @@ elsif ( $op eq 'edit_save' ) { > my $password = $input->param('smtp_password') || undef; > my $debug = ( scalar $input->param('smtp_debug_mode') ) ? 1 : 0; > >+ my $password_changed = $input->param('password_changed') // 'no'; >+ > try { > $smtp_server->password( $password ) >- if defined $password and $password ne '****' >- or not defined $password; >+ if $password_changed eq 'yes'; > > $smtp_server->set( > { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt >index 66975366db..4a8f2de348 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt >@@ -173,10 +173,11 @@ SMTP servers > <li> > <label for="smtp_password">Password: </label> > [% IF smtp_server.password %] >- <input type="password" name="smtp_password" id="smtp_password" size="60" value="****"/> >+ <input type="password" name="smtp_password" id="smtp_password" size="60" value="****"/><a href="#" id="clear_password_changes" title="Clear password changes" aria-label="Clear password changes"> <i class="fa fa-undo" aria-hidden="true"></i></a> > [% ELSE %] > <input type="password" name="smtp_password" id="smtp_password" size="60" value=""/> > [% END %] >+ <input type="hidden" name="password_changed" id="password_changed" value="no"/> > </li> > <li> > <label for="smtp_debug_mode">Debug mode: </label> >@@ -271,6 +272,16 @@ SMTP servers > <script> > $(document).ready(function() { > >+ $("#smtp_password").on( 'change', function () { >+ $("#password_changed").val("yes"); >+ }); >+ >+ $("#clear_password_changes").on( 'click', function (e) { >+ e.preventDefault(); >+ $("#smtp_password").val("****"); >+ $("#password_changed").val("no"); >+ }); >+ > var smtp_servers_url = '/api/v1/config/smtp_servers'; > window.smtp_servers = $("#smtp_servers").api({ > "ajax": { >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27060
:
113846
| 113881