Simple example: rename htaccess to htpasswd.

pull/7/head
Ferry Boender 10 years ago
parent c0ecdd4371
commit dfe9cc2393
  1. 1
      examples/simple/htpasswd
  2. 10
      examples/simple/job_add_user.sh

@ -1,2 +1,3 @@
a:{SHA}qZk+NkcGgWq6PiVxeFDCbJzQ2J0=
fb:{SHA}MW7uIgOKtXmGLGk4ZKZl/cYBAjw=
DLKFj:{SHA}qZk+NkcGgWq6PiVxeFDCbJzQ2J0=

@ -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"

Loading…
Cancel
Save