]> git.plutz.net Git - rawnet/commitdiff
Squashed 'cgilite/' changes from 6c1784b..343a22a
authorPaul Hänsch <paul@plutz.net>
Thu, 7 Oct 2021 22:32:28 +0000 (00:32 +0200)
committerPaul Hänsch <paul@plutz.net>
Thu, 7 Oct 2021 22:32:28 +0000 (00:32 +0200)
343a22a cleaner display of activation link, include port number in activation link
f6fa7fb strip _BASE path from PATH_INFO variable

git-subtree-dir: cgilite
git-subtree-split: 343a22a944f0300c5518e346ee1a85581741027c

cgilite.sh
users.sh

index a2aa32924bdc7ed30cc35fb053b416859a05f93c..526a0fc738410dcfafa31017a836cc5ad7a71a03 100755 (executable)
@@ -48,7 +48,7 @@ _EXEC="${_EXEC:-${0%/*}}"
 _DATA="${_DATA:-.}"
 _EXEC="${_EXEC%/}" _DATA="${_DATA%/}" _BASE="${_BASE%/}"
 
-# Carriare Return and Line Break characters for convenience
+# Carriage Return and Line Break characters for convenience
 CR="\r"
 BR='
 '
@@ -90,7 +90,7 @@ HEX_DECODE(){
         *) out="${out}${in%"${in#?}"}"; in="${in#?}"; continue;;
     esac;
 
-    # Hex escaes for printf (e.g. \x41) are not portable 
+    # Hex escapes for printf (e.g. \x41) are not portable 
     # The portable way for Hex output is transforming Hex to Octal
     # (e.g. \x41 = \101)
     case $in in
@@ -146,6 +146,7 @@ if [ -z "$REQUEST_METHOD" ]; then
 
     SERVER_PROTOCOL="${SERVER_PROTOCOL%${CR}}"
     PATH_INFO="$(HEX_DECODE % "${REQUEST_URI%\?*}" |PATH)"
+    PATH_INFO="$(PATH "/${PATH_INFO#${_BASE}}")"
     [ "${REQUEST_URI}" = "${REQUEST_URI#*\?}" ] \
     && QUERY_STRING='' \
     || QUERY_STRING="${REQUEST_URI#*\?}"
index c13703b418fc057adcdc936d26b515c55a3a74f7..eaf4c272a721b87642f338f3d888155fea9fd47d 100755 (executable)
--- a/users.sh
+++ b/users.sh
@@ -151,7 +151,7 @@ user_register(){
       RELEASE "$user_db"
 
       debug "Sending Activation Link:" \
-            "https://${HTTP_HOST%:*}/${_BASE}${PATH_INFO}?user_confirm=${uid}+$(session_mac "$uid")"
+            "https://${HTTP_HOST}${_BASE}${PATH_INFO}?user_confirm=${uid}+$(session_mac "$uid")"
       sendmail -t -f "$MAILFROM" <<-EOF
        From: ${MAILFROM}
        To: ${email}
@@ -161,7 +161,7 @@ user_register(){
 
        You can activate your account using this link:
 
-           https://${HTTP_HOST%:*}/${_BASE}${PATH_INFO}?user_confirm=${uid}+$(session_mac "$uid")
+           https://${HTTP_HOST}${_BASE}${PATH_INFO}?user_confirm=${uid}+$(session_mac "$uid")
 
        This registration link will expire after 24 hours.
 
@@ -220,7 +220,7 @@ user_invite(){
            >>"$user_db"
     RELEASE "$user_db"
     debug "Sending Invitation Link:" \
-          "https://${HTTP_HOST%:*}/${_BASE}${PATH_INFO}?user_confirm=${uid}+$(session_mac "$uid")"
+          "https://${HTTP_HOST}${BASE}${PATH_INFO}?user_confirm=${uid}+$(session_mac "$uid")"
     sendmail -t -f "$MAILFROM" <<-EOF
        From: ${MAILFROM}
        To: ${email}
@@ -232,7 +232,7 @@ user_invite(){
 
        You can create your account using this link:
 
-           https://${HTTP_HOST%:*}/${_BASE}${PATH_INFO}?user_confirm=${uid}+$(session_mac "$uid")
+           https://${HTTP_HOST}${_BASE}${PATH_INFO}?user_confirm=${uid}+$(session_mac "$uid")
 
        This registration link will expire after 24 hours.