From ac1fdfe2258940cf4b7003d816b0e1723ed8963c Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi 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 Signed-off-by: Liz Rea Signed-off-by: Josef Moravec Signed-off-by: Nick Clemens (cherry picked from commit 0cd4ca289bd2e1bd11fdbd015225a909971ce213) Signed-off-by: Martin Renvoize --- 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 < "$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.39.5