Hi anonymous user , I recommend in this case to redirect to a sign-up page instead of automatically registering the user. There are a few reasons for this. What if the user already exists, but the username is input wrong? Or they use the wrong email? It's best to tell the user why the login is failing, especially if they've already visited the site. This could lead to duplicate users or misspelled email addresses, etc.
Please let me know if you have any questions.
Best,
James