Change connection way

add new handler to the login page , change the way login works and
extract the main to ApiProfile (thi is the new hendler for the frams)