-user_register(){
- # reserve account, send registration mail
- # preliminary uid, expiration, signature
- local uid="$(timeid)"
- local uname="$(POST uname |user_checkname)"
- local email="$(POST email |user_checkemail)"
- local pwsalt="$(randomid)"
- local pw="$(POST pw |grep -m1 -xE '.{6,}' )" pwconfirm="$(POST pwconfirm)"
-
- if [ "$USER_REGISTRATION" != true -a -s "$user_db" ]; then
- REDIRECT "${_BASE}${PATH_INFO}#ERROR_REGISTRATION_DISABLED"
- fi
-
- if [ "$USER_REQUIREEMAIL" = true ]; then
- if [ ! "email" ]; then
- REDIRECT "${_BASE}${PATH_INFO}#ERROR_EMAIL_INVALID"
- elif user_emailexist "$email"; then
- REDIRECT "${_BASE}${PATH_INFO}#ERROR_EMAIL_EXISTS"
- elif new_user "$uid" status=pending email="$email" expire="$((_DATE + USER_CONFIRMEXPIRE))"; then
- debug "Sending Activation Link:" \
- "${SCHEMA}://${HTTP_HOST}${_BASE}${PATH_INFO}?user_confirm=${uid}+$(session_mac "$uid")"
- "$SENDMAIL" -t -f "$MAILFROM" <<-EOF