Refactor handling of AJAX requests in sign in view. Close #15