Fix authentication process to avoid double redirection and fill in login form properly.