Handling login/register/errors phases