From 35660d4705faf979cb69e9bf2b80c39c76c3700f Mon Sep 17 00:00:00 2001 From: Dominika Liberda Date: Thu, 29 Oct 2020 22:34:14 +0100 Subject: [PATCH] fixes in mailcode.shs --- webroot/api/mailcode.shs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/webroot/api/mailcode.shs b/webroot/api/mailcode.shs index 4d0eaad..53c37e6 100644 --- a/webroot/api/mailcode.shs +++ b/webroot/api/mailcode.shs @@ -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