Skip to content

Commit cebe558

Browse files
committed
dns_1984hosting.sh: fix login with valid csrftoken
1 parent 927369b commit cebe558

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

dnsapi/dns_1984hosting.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@ _1984hosting_login() {
140140
password=$(printf '%s' "$One984HOSTING_Password" | _url_encode)
141141
url="https://management.1984hosting.com/accounts/checkuserauth/"
142142

143+
csrf_html=$(_get "https://1984.hosting/accounts/login/" | grep 'csrfmiddlewaretoken')
144+
csrf_token=$(echo "$csrf_html" | _egrep_o 'value=".*"' | sed 's/value=//' | sed 's/"//g' | _head_n 1)
145+
_debug2 "csrf_token: $csrf_token"
146+
export _H1="Cookie: csrftoken=$csrf_token"
147+
export _H2="X-CSRFToken: $csrf_token"
148+
143149
response="$(_post "username=$username&password=$password&otpkey=" $url)"
144150
response="$(echo "$response" | _normalizeJson)"
145151
_debug2 response "$response"

0 commit comments

Comments
 (0)