From dfe9cc2393d4be17bdc144f7c7ed963fe663c0b3 Mon Sep 17 00:00:00 2001 From: Ferry Boender Date: Wed, 1 Apr 2015 19:22:36 +0200 Subject: [PATCH] Simple example: rename htaccess to htpasswd. --- examples/simple/{htaccess => htpasswd} | 1 + examples/simple/job_add_user.sh | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) rename examples/simple/{htaccess => htpasswd} (64%) diff --git a/examples/simple/htaccess b/examples/simple/htpasswd similarity index 64% rename from examples/simple/htaccess rename to examples/simple/htpasswd index 326cc19..d479313 100644 --- a/examples/simple/htaccess +++ b/examples/simple/htpasswd @@ -1,2 +1,3 @@ a:{SHA}qZk+NkcGgWq6PiVxeFDCbJzQ2J0= fb:{SHA}MW7uIgOKtXmGLGk4ZKZl/cYBAjw= +DLKFj:{SHA}qZk+NkcGgWq6PiVxeFDCbJzQ2J0= diff --git a/examples/simple/job_add_user.sh b/examples/simple/job_add_user.sh index e3114ee..4e48b6e 100755 --- a/examples/simple/job_add_user.sh +++ b/examples/simple/job_add_user.sh @@ -1,12 +1,16 @@ #!/bin/sh -HTACCESS=htaccess +HTPASSWD=htpasswd err() { echo $* >&2 exit 1 } +echo $username +echo $password1 +echo $password2 + if [ -z "$password1" ]; then err "Empty password specified" fi @@ -14,13 +18,13 @@ if [ "$password1" != "$password2" ]; then err "Passwords do not match." fi -if [ $(egrep "^$username:" $HTACCESS) ]; then +if [ $(egrep "^$username:" $HTPASSWD) ]; then UPDATE=1 else UPDATE=0 fi -htpasswd -s -b $HTACCESS $username $password1 || exit $? +htpasswd -s -b $HTPASSWD $username $password1 || exit $? if [ "$UPDATE" -eq 1 ]; then echo "User password updated"