S
S
Shredinger422020-02-26 19:03:08
JavaScript
Shredinger42, 2020-02-26 19:03:08

How to implement authorization in mail.ru on fuel kotlin?

I am writing an android application to communicate with the mail.ru cloud. Stuck on authorization, I write this code:

val bodyJson = """
{
"Login" : "login",
"Password" : "password",
"Domain" : "mail.ru"
}
""".trimIndent()

val ( request, response, result) = Fuel
.post(" https://auth.mail.ru/cgi-bin/auth ").body(bodyJson).response()

in response, I get back just a mail.ru page with 200 code regardless of username and password.
I looked at other people's implementations in php and c #, did it by analogy. What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Proskurin, 2019-07-06
@zzzfairy

In general, it can be very seriously reduced. In essence, you need a single function for the calculation, which will take three numbers from the fields, multiply them by each other and then by the number. It's even better to remove global variables that change in the code. It turns out such a simple code

const persons = document.querySelectorAll(".counter-block-input")[0];
const restDays = document.querySelectorAll(".counter-block-input")[1];
const place = document.getElementById("select");
const totalValue = document.getElementById("total");

function calculateTotal() {
    const personsSum = +persons.value || 0;
    const daysSum = +restDays.value || 0;
    const placeIndex = place.selectedIndex;

    const total = (daysSum + personsSum) * place.options[placeIndex].value * 4000;

    totalValue.textContent = total;
}

persons.addEventListener("change", calculateTotal);
restDays.addEventListener("change", calculateTotal);
place.addEventListener("change", calculateTotal);
calculateTotal(); // сразу вызываем, чтобы обнулить поле

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question