ocw/webroot/smscode.shs
2020-09-19 17:21:38 +02:00

22 lines
800 B
Bash

#!/bin/bash
if ! session_verify ${cookies[sh_session]}; then
exit 0
fi
if [[ ${get_data[phone]} != "" && ${post_data[code]} != "" ]]; then
tokens=$(curl -s -X POST -H "Content-type: application/json" --data '{"phoneOS":"Android"}' "https://api-inmobile-pl.easypack24.net/v1/confirmSMSCode/${get_data[phone]}/${post_data[code]}")
add_account_refreshtoken $(echo $tokens | jq -r .refreshToken)
add_account_authtoken $(echo $tokens | jq -r .authToken)
echo "success! the token was added to the database!"
elif [[ ${get_data[phone]} != "" ]]; then
curl -s "https://api-inmobile-pl.easypack24.net/v1/sendSMSCode/${get_data[phone]}" > /dev/null
echo "<form method='post'>
<label for='code'>SMS code:</label>
<input type='text' name='code'><br>
<input type='submit' value='Send'>
</form>"
fi