]> git.plutz.net Git - shellwiki/commitdiff
Merge commit '47bbf18dd9e54f60c6406b991760f057ce38f648'
authorPaul Hänsch <paul@plutz.net>
Wed, 18 May 2022 20:35:00 +0000 (22:35 +0200)
committerPaul Hänsch <paul@plutz.net>
Wed, 18 May 2022 20:35:00 +0000 (22:35 +0200)
1  2 
cgilite/users.sh

diff --combined cgilite/users.sh
index 254d61c91953e87e882e7c4efe957ef50d41b576,ca986cd6f737a00c78915379bfe83c3f14eba6d5..ca986cd6f737a00c78915379bfe83c3f14eba6d5
@@@ -16,6 -16,8 +16,8 @@@ MAILFROM="${MAILDOMAIN-noreply@${HTTP_H
  
  HTTP_HOST="$(HEADER Host)"
  
+ [ "$HTTPS" ] && SCHEMA=https || SCHEMA=http
  # == FILE FORMAT ==
  # UID UNAME   STATUS  EMAIL   PWSALT  PWHASH  EXPIRE  DEVICES FUTUREUSE
  #             (pending|active|deleted)
@@@ -233,7 -235,7 +235,7 @@@ user_register()
        REDIRECT "${_BASE}${PATH_INFO}#ERROR_EMAIL_EXISTS"
      elif new_user "$uid" status=pending email="$email" expire="$((_DATE + 86400))"; then
        debug "Sending Activation Link:" \
-             "https://${HTTP_HOST}${_BASE}${PATH_INFO}?user_confirm=${uid}+$(session_mac "$uid")"
+             "${SCHEMA}://${HTTP_HOST}${_BASE}${PATH_INFO}?user_confirm=${uid}+$(session_mac "$uid")"
        "$SENDMAIL" -t -f "$MAILFROM" <<-EOF
        From: ${MAILFROM}
        To: ${email}
  
        You can activate your account using this link:
  
-           https://${HTTP_HOST}${_BASE}${PATH_INFO}?user_confirm=${uid}+$(session_mac "$uid")
+           ${SCHEMA}://${HTTP_HOST}${_BASE}${PATH_INFO}?user_confirm=${uid}+$(session_mac "$uid")
  
        This registration link will expire after 24 hours.
  
@@@ -295,7 -297,7 +297,7 @@@ user_invite()
      REDIRECT "${_BASE}${PATH_INFO}#ERROR_EMAIL_EXISTS"
    elif new_user "$uid" status=pending email="$email" expire="$((_DATE + 86400))"; then
      debug "Sending Invitation Link:" \
-           "https://${HTTP_HOST}${_BASE}${PATH_INFO}?user_confirm=${uid}+$(session_mac "$uid")"
+           "${SCHEMA}://${HTTP_HOST}${_BASE}${PATH_INFO}?user_confirm=${uid}+$(session_mac "$uid")"
      "$SENDMAIL" -t -f "$MAILFROM" <<-EOF
        From: ${MAILFROM}
        To: ${email}
  
        You can create your account using this link:
  
-           https://${HTTP_HOST}${_BASE}${PATH_INFO}?user_confirm=${uid}+$(session_mac "$uid")
+           ${SCHEMA}://${HTTP_HOST}${_BASE}${PATH_INFO}?user_confirm=${uid}+$(session_mac "$uid")
  
        This registration link will expire after 24 hours.
  
@@@ -555,7 -557,7 +557,7 @@@ w_user_invite()
      new_user "$uid" status=pending email="$email" expire="$((_DATE + 86400))"
      cat <<-EOF
          [p An anonymous user account has been set up. Send the following link to the intended user, so they may claim their account. The link will remain valid for 24 hours.]
-         [p . $(HTML "https://${HTTP_HOST}${_BASE}${PATH_INFO}?user_confirm=${uid}+$(session_mac "$uid")" |debug)]
+         [p . $(HTML "${SCHEMA}://${HTTP_HOST}${_BASE}${PATH_INFO}?user_confirm=${uid}+$(session_mac "$uid")" |debug)]
  
          [p [a href="#" . Set up another account]]
        EOF