This is not an easy way, but still it works.
You have a form on your page that is filled out by the user.
The user clicks the submit button.
An ajax request is sent to the server.
A server-side implementation can check for a session or not. and accordingly you can send the response code 401 .. (response.setStatus ());
This 401 can be tested on the client side using ajax --- xhr.status
If the answer is 401, you can show the login form and hide the current form. using js and css.
The user fills in the registration data and clicks send.
You can check on the server side and check on the client side the status of this login request.
if the login is successful, you can submit the first form using ajax or js ..
Konza source share