#!/bin/sh

usage() {
  echo 'Usage: fix_auth.sh [username]'
  echo ''
  echo 'If you provide username, you will be able to change password for the specified user.'
  echo 'If no username is provided, new user will be created.'
  exit 1
}

if [[ ${#} -eq 0 ]] ; then
  PYTHONPATH="$(pwd)/lib/:$(pwd):${PYTHONPATH}" python ./manage.py createsuperuser
elif [[ ${#} -eq 1 ]] ; then
  PYTHONPATH="$(pwd)/lib/:$(pwd):${PYTHONPATH}" python ./manage.py changepassword ${1}
else
  usage
fi
exit 0
