Bugzilla – Attachment 169845 Details for
Bug 37512
Add a function to reset login attempts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37512: Add a function to reset login attempts
Bug-37512-Add-a-function-to-reset-login-attempts.patch (text/plain), 3.10 KB, created by
Baptiste Wojtkowski (bwoj)
on 2024-07-29 15:15:30 UTC
(
hide
)
Description:
Bug 37512: Add a function to reset login attempts
Filename:
MIME Type:
Creator:
Baptiste Wojtkowski (bwoj)
Created:
2024-07-29 15:15:30 UTC
Size:
3.10 KB
patch
obsolete
>From 4842d73b7aeb6745a9678fb69084f852804856d4 Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Mon, 29 Jul 2024 16:35:55 +0200 >Subject: [PATCH] Bug 37512: Add a function to reset login attempts > >When using system preference 'FailedLoginAttempts', a patron's account is blocked after X many failed login attempts on the OPAC. > >This patch adds, like for "Patron's card has expired" message : > * a link to reset login attempts to 0 >Link is only displayed if libarian has permission to edit patrons. > >Reset login attempts to 0 feature uses members/setstatus.pl with >resetloginattempts=y like reregistration=y for an expired patron > >To test: >1. Change system preference 'FailedLoginAttempts' to a small number, like 2 >2. Go to a patron's account and copy their username (while you're there, change the password and add some fines, too) >3. In the OPAC, try to log in with the username and a wrong password 3 times >4. Go back to the patron's account in the staff interface >5. Note that there is a message : "Patron's account has been locked (due to 3 failed login attempts)" >6. Click on "Reset login attempts", page reloads and you see patron is unlocked >--- > koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc | 1 + > members/setstatus.pl | 3 +++ > 2 files changed, 4 insertions(+) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc >index 8a3248a..82d1a35 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc >@@ -63,6 +63,7 @@ > [% IF CAN_user_borrowers_edit_borrowers %] > <span> > <a href="/cgi-bin/koha/members/member-password.pl?member=[% patron.borrowernumber | html %]">Change password</a> >+ or <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% patron.borrowernumber | uri %]&destination=circ&resetloginattempts=y">Reset login attempts</a> > </span> > [% END %] > </li> >diff --git a/members/setstatus.pl b/members/setstatus.pl >index 83ef159..faf9bf9 100755 >--- a/members/setstatus.pl >+++ b/members/setstatus.pl >@@ -40,6 +40,7 @@ my $destination = $input->param("destination") || ''; > my $borrowernumber=$input->param('borrowernumber'); > my $status = $input->param('status'); > my $reregistration = $input->param('reregistration') || ''; >+my $resetloginattempts = $input->param('resetloginattempts') || ''; > > my $dbh = C4::Context->dbh; > my $dateexpiry; >@@ -54,6 +55,8 @@ if ( $logged_in_user->can_see_patron_infos($patron) ) { > if ( $reregistration eq 'y' ) { > # re-reregistration function to automatic calcul of date expiry > $dateexpiry = $patron->renew_account; >+ } elsif ( $resetloginattempts eq 'y' ) { >+ $patron->login_attempts(0)->store; > } else { > my $sth = $dbh->prepare("UPDATE borrowers SET debarred = ?, debarredcomment = '' WHERE borrowernumber = ?"); > $sth->execute( $status, $borrowernumber ); >-- >2.43.0
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 37512
:
169845
|
169846
|
169854
|
169865