fixes in mailcode.shs

master
Dominika Liberda 2020-10-29 22:34:14 +01:00
parent 7df39b75aa
commit 35660d4705
1 changed files with 3 additions and 2 deletions

View File

@ -4,15 +4,16 @@ if ! session_verify "${cookies[sh_session]}"; then
return
fi
source "${cfg[namespace]}/code/common.sh"
if [[ "${post_data[code]}" != '' && "${post_data[phone]}" != '' ]]; then
username="$(session_get_username ${cookies[sh_session]})"
username="$(session_get_username "${cookies[sh_session]}")"
mail="$(get_account_mail $username)"
if [[ "$(cat secret/mail.dat | grep "$username:" | grep ":${post_data[code]}:")" != '' ]]; then
sed -i "s/$username:$mail:${post_data[code]}:no/$username:$mail:${post_data[code]}:yes/" secret/mail.dat
curl -s "https://api-inmobile-pl.easypack24.net/v1/sendSMSCode/${post_data[phone]}" > /dev/null
jq -n '{status: $ARGS.positional[0], msg: $ARGS.positional[1]}' --args 200 "success"
elif [[ $status == 1 && $reason != '' ]]; then
elif [[ $status == 1 ]]; then
jq -n '{status: $ARGS.positional[0], msg: $ARGS.positional[1]}' --args -1 "$reason"
fi
fi