Skip to content

Commit

Permalink
treehouses password refactor (fixes #2057) (#2058)
Browse files Browse the repository at this point in the history
Co-authored-by: dogi <[email protected]>
  • Loading branch information
JLKwong and dogi authored Mar 4, 2021
1 parent a079d65 commit 51beb4b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
20 changes: 13 additions & 7 deletions modules/password.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@ function password {
checkrpi
checkroot
checkargn $# 1
if [[ $1 == "" ]]; then
options="$1"
case "$options" in
"")
log_and_exit1 "Error: Password not entered"
elif [ $1 == "disable" ]; then
disablepassword
elif [ $1 == "enable" ]; then
;;
"disable")
disablepassword
;;
"enable")
enablepassword
else
chpasswd <<< "pi:$1"
;;
*)
chpasswd <<< "pi:$options"
echo "Success: the password has been changed"
fi
;;
esac
}

function disablepassword {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@treehouses/cli",
"version": "1.25.11",
"version": "1.25.12",
"remote": "4000",
"description": "Thin command-line interface for Raspberry Pi low level configuration.",
"main": "cli.sh",
Expand Down

0 comments on commit 51beb4b

Please sign in to comment.