#!/bin/bash source "${cfg[namespace]}/code/common.sh" if [[ "${post_data[login]}" != '' && "${post_data[password]}" != '' && "${post_data[mail]}" != '' ]]; then mail="$(echo "${post_data[mail]}" | sed -s 's/%40/@/')" if ! check_mail "$mail"; then status=1 reason="This mail address is already in use!" else register "${post_data[login]}" "${post_data[password]}" status=$? verification="$RANDOM" echo "${post_data[login]}:$mail:$verification:no" >> secret/mail.dat fi if [[ $status == 0 ]]; then sender_name="${cfg[who]}" mailsend "$mail" "OCW mail verification" "Hi ${post_data[login]}, Your code: $verification Have a wonderful day! ~ ${cfg[who]}" & jq -n '{status: $ARGS.positional[0], msg: $ARGS.positional[1]}' --args 200 "success" elif [[ $status == 1 && $reason != '' ]]; then jq -n '{status: $ARGS.positional[0], msg: $ARGS.positional[1]}' --args -1 "$reason" fi fi