Bugzilla – Attachment 86932 Details for
Bug 17746
koha-reset-passwd should use Koha::Patron->set_password
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17746: Make koha-reset-passwd user set_password.pl
Bug-17746-Make-koha-reset-passwd-user-setpasswordp.patch (text/plain), 2.56 KB, created by
Liz Rea
on 2019-03-23 01:52:30 UTC
(
hide
)
Description:
Bug 17746: Make koha-reset-passwd user set_password.pl
Filename:
MIME Type:
Creator:
Liz Rea
Created:
2019-03-23 01:52:30 UTC
Size:
2.56 KB
patch
obsolete
>From 53c3bf5faadef21b855ff9a4caa9c4186c06d322 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 5 Feb 2019 14:04:12 -0300 >Subject: [PATCH] Bug 17746: Make koha-reset-passwd user set_password.pl > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: Liz Rea <wizzyrea@gmail.com> >--- > debian/scripts/koha-reset-passwd | 63 ++++++++++++++++++++++++++++------------ > 1 file changed, 44 insertions(+), 19 deletions(-) > >diff --git a/debian/scripts/koha-reset-passwd b/debian/scripts/koha-reset-passwd >index 317e2bce66..ac3c40673f 100755 >--- a/debian/scripts/koha-reset-passwd >+++ b/debian/scripts/koha-reset-passwd >@@ -2,6 +2,7 @@ > # > # koha-reset-passwd -- reset password for a user in a Koha instance > # Copyright 2010 Catalyst IT, Ltd >+# Copyright 2019 Theke Solutions > # > # This program is free software: you can redistribute it and/or modify > # it under the terms of the GNU General Public License as published by >@@ -27,32 +28,56 @@ else > exit 1 > fi > >-pwdigest() { >- echo -n "$1" | >- perl -e 'use Digest::MD5 qw(md5_base64); >- while (<>) { print md5_base64($_), "\n"; }' >+usage() >+{ >+ local scriptname=$0 >+ cat <<EOF >+Resets the password for the specified user on the Koha instance. >+ >+Usage: $scriptname instancename userid >+ >+Note: The generated password will be printed. >+EOF > } > >+set_password() >+{ >+ local instancename=$1 >+ local userid=$2 >+ local password=$(pwgen 12 1) > >-[ $# -lt 2 ] && die "Usage: $0 instancename username..." >-instance="$1" >-shift >+ # Optionally use alternative paths for a dev install >+ adjust_paths_dev_install $1 >+ >+ if [ "$DEV_INSTALL" = "" ]; then >+ KOHA_BINDIR=$KOHA_HOME/bin >+ else >+ KOHA_BINDIR=$KOHA_HOME/misc >+ fi >+ >+ if sudo -u "$instancename-koha" -H \ >+ env PERL5LIB=$PERL5LIB \ >+ KOHA_CONF="/etc/koha/sites/$instancename/koha-conf.xml" \ >+ $KOHA_BINDIR/admin/set_password.pl --userid $userid --password $password ; then > >-temp="$(mktemp)" >+ echo "$userid $password" >+ return 0 >+ else >+ return 1 >+ fi >+} >+ >+if [ $# -lt 2 ]; then >+ usage >+ die "Wrong parameters" >+fi > >-cat <<eof > "$temp" >-use koha_$instance; >-eof >+instance="$1" >+shift > > for userid in "$@" > do >- password="$(pwgen 12 1)" >- digest="$(pwdigest $password)" >- echo "$userid $password" >- echo "UPDATE borrowers SET password = '$digest' WHERE userid = '$userid';" \ >- >> "$temp" >+ set_password $instance $userid > done > >-mysql --defaults-extra-file=/etc/mysql/koha-common.cnf < "$temp" >- >-rm "$temp" >+exit 0 >-- >2.11.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 17746
:
84797
|
84798
|
84898
|
84899
|
85363
|
86932
|
86933
|
86934
|
86937
|
86938
|
86939