Loading deployment/salt/base/docker-compose.sls +1 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ install-deps: - gnupg2 - pass - certbot - jq - require: - upgrade-all Loading scripts/base.sh +0 −28 Original line number Diff line number Diff line Loading @@ -37,31 +37,3 @@ SMTP_PW=$(grep ^SMTP_PW= "$ENVFILE" | awk -F= '{ print $NF }') SMTP_HOST=$(grep ^SMTP_HOST= "$ENVFILE" | awk -F= '{ print $NF }') MYSQL_ROOT_PASSWORD=$(grep ^MYSQL_ROOT_PASSWORD= "$ENVFILE" | awk -F= '{ print $NF }') # the encoding/decoding is taken from here: https://stackoverflow.com/questions/296536/how-to-urlencode-data-for-curl-command/10660730#10660730 urlencode() { local string="${1}" local strlen=${#string} local encoded="" local pos c o for (( pos=0 ; pos<strlen ; pos++ )); do c=${string:$pos:1} case "$c" in [-_.~a-zA-Z0-9] ) o="${c}" ;; * ) printf -v o '%%%02x' "'$c" esac encoded+="${o}" done echo "${encoded}" # You can either set a return variable (FASTER) } urldecode() { # This is perhaps a risky gambit, but since all escape characters must be # encoded, we can replace %NN with \xNN and pass the lot to printf -b, which # will decode hex for us printf -v REPLY '%b' "${1//%/\\x}" # You can either set a return variable (FASTER) echo "${REPLY}" #+or echo the result (EASIER)... or both... :p } scripts/generate-signup-link.sh +2 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,8 @@ fi AUTH_SECRET=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1) echo "$EMAIL:$AUTH_SECRET" >> /mnt/repo-base/volumes/accounts/auth.file SIGNUP_URL="https://welcome.$DOMAIN/?authmail=$(urlencode "$EMAIL")&authsecret=$AUTH_SECRET" ENCODED_EMAIL=$(jq -nr --arg v "$EMAIL" '$v|@uri') SIGNUP_URL="https://welcome.$DOMAIN/?authmail=$ENCODED_EMAIL&authsecret=$AUTH_SECRET" echo "The new user can sign up now at $SIGNUP_URL" echo -e "to:$EMAIL Loading Loading
deployment/salt/base/docker-compose.sls +1 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ install-deps: - gnupg2 - pass - certbot - jq - require: - upgrade-all Loading
scripts/base.sh +0 −28 Original line number Diff line number Diff line Loading @@ -37,31 +37,3 @@ SMTP_PW=$(grep ^SMTP_PW= "$ENVFILE" | awk -F= '{ print $NF }') SMTP_HOST=$(grep ^SMTP_HOST= "$ENVFILE" | awk -F= '{ print $NF }') MYSQL_ROOT_PASSWORD=$(grep ^MYSQL_ROOT_PASSWORD= "$ENVFILE" | awk -F= '{ print $NF }') # the encoding/decoding is taken from here: https://stackoverflow.com/questions/296536/how-to-urlencode-data-for-curl-command/10660730#10660730 urlencode() { local string="${1}" local strlen=${#string} local encoded="" local pos c o for (( pos=0 ; pos<strlen ; pos++ )); do c=${string:$pos:1} case "$c" in [-_.~a-zA-Z0-9] ) o="${c}" ;; * ) printf -v o '%%%02x' "'$c" esac encoded+="${o}" done echo "${encoded}" # You can either set a return variable (FASTER) } urldecode() { # This is perhaps a risky gambit, but since all escape characters must be # encoded, we can replace %NN with \xNN and pass the lot to printf -b, which # will decode hex for us printf -v REPLY '%b' "${1//%/\\x}" # You can either set a return variable (FASTER) echo "${REPLY}" #+or echo the result (EASIER)... or both... :p }
scripts/generate-signup-link.sh +2 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,8 @@ fi AUTH_SECRET=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1) echo "$EMAIL:$AUTH_SECRET" >> /mnt/repo-base/volumes/accounts/auth.file SIGNUP_URL="https://welcome.$DOMAIN/?authmail=$(urlencode "$EMAIL")&authsecret=$AUTH_SECRET" ENCODED_EMAIL=$(jq -nr --arg v "$EMAIL" '$v|@uri') SIGNUP_URL="https://welcome.$DOMAIN/?authmail=$ENCODED_EMAIL&authsecret=$AUTH_SECRET" echo "The new user can sign up now at $SIGNUP_URL" echo -e "to:$EMAIL Loading