Understanding how login Works

Hey,
So i wanted to do some changes to the login page, thats when i thought its better to understand how the login works . I followed three files login.py login.js login.html . I managed to follow the javascript in login.js to come across this ajax call :

   // Login
login.call = function(args) {
    frappe.freeze();
    $.ajax({
        type: "POST",
        url: "/",
        data: args,
        dataType: "json",
        statusCode: login.login_handlers
    }).always(function(){
        frappe.msgprint(__("login here"));
        frappe.unfreeze();
    });
}

I am not familiar with ajax much, but could make out the args which contains login credentials are passed as a json object. What i need to understand is where is the control passed to ? which function actually checks the validity of credentials ? Also i am unable to find the definition of frappe.unfreeze() function call ? Where are all these defined ?

It would be great if someone would help me understand this !

Many thanks! :smile:
Akarsh

Its not very straight forward but its here:

Thanks @rmehta . i could make some sense out of auth.py file, but where does the redirection to the “/desk” take place? i would like to redirect to a another page before the desk.

Hey @yashodhan I did come across that, but i commented the two lines and gave a ‘return’ instead . The redirection still happens. Any idea why? I was expecting some error instead.

did you figure out what how to do it?

Similar topic discussed here.
It lists where the redirection happens, and how to go about changing it.