|
|
@ -76,6 +76,9 @@ _load_credentials() { |
|
|
|
fi |
|
|
|
|
|
|
|
if [ -z "${cyon_username}" ] || [ -z "${cyon_password}" ]; then |
|
|
|
cyon_username="" |
|
|
|
cyon_password="" |
|
|
|
cyon_otp_secret="" |
|
|
|
_err "" |
|
|
|
_err "You haven't set your cyon.ch login credentials yet." |
|
|
|
_err "Please set the required cyon environment variables." |
|
|
@ -168,14 +171,11 @@ _login() { |
|
|
|
|
|
|
|
_info " success" |
|
|
|
|
|
|
|
|
|
|
|
# NECESSARY!! Load the main page after login, before the OTP check. |
|
|
|
curl "https://my.cyon.ch/" -s --compressed -b "${cookiejar}" >/dev/null |
|
|
|
|
|
|
|
|
|
|
|
# todo: instead of just checking if the env variable is defined, check if we actually need to do a 2FA auth request. |
|
|
|
|
|
|
|
|
|
|
|
# 2FA authentication with OTP? |
|
|
|
if [ ! -z "${cyon_otp_secret}" ]; then |
|
|
|
_info " - Authorising with OTP code..." |
|
|
@ -298,9 +298,8 @@ _delete_txt() { |
|
|
|
|
|
|
|
_dns_entry_num=0 |
|
|
|
|
|
|
|
echo "${_dns_entries}" | while read -r _hash _identifier |
|
|
|
do |
|
|
|
((_dns_entry_num++)) |
|
|
|
echo "${_dns_entries}" | while read -r _hash _identifier; do |
|
|
|
_dns_entry_num=$((_dns_entry_num + 1)) |
|
|
|
|
|
|
|
delete_txt_response=$(curl \ |
|
|
|
"https://my.cyon.ch/domain/dnseditor/delete-record-async" \ |
|
|
@ -335,7 +334,7 @@ _delete_txt() { |
|
|
|
|
|
|
|
_check_2fa_miss() { |
|
|
|
# Did we miss the 2FA? |
|
|
|
if [[ "$1" =~ "multi_factor_form" ]] ; then |
|
|
|
if test "${1#*multi_factor_form}" != "$1"; then |
|
|
|
_fail " Missed OTP authentication!" |
|
|
|
fi |
|
|
|
} |
|
|
|