04-09-2017, 08:23 PM
Hey,
I'm not a pro but my thoughts might help you:
As long as UserSpice uses a PHP-Validation Class and stuff like csrf-tokens, you probably have to use Ajax. As you might have seen, putting login, register and forgot password together in index.php, will cause some php spaghetti. To keep structure and functionality you need JSON aswell.
Example Page: 'login.php'
Without Ajax, the page will get a hard refresh after the submit button is clicked. The php gets executed and validates the input. If the input is invalid, the modal will broke. The error message will be displayed.
With Ajax, login.php will be executed in "background". You're modal won't break, but the action is taking place in "login.php". So, if users input is invalid, you need JSON to get the variables back. With some js and jquery skills it should be possible to not break the site.
Just for security and usability i would keep them by their own path. But that's my opinion. What you can also do:
index.php
->login modal with <form action="login.php"/>
->if validation->passed = Log User in (set in login.php)
->if validation not passed -> Redirect to login.php />
index.php
->register modal with <form action="join.php"/>
->use some live jquery to be sure that user fills out everything and correctly
->if validation->passed = Redirect to success page
->if validation not passed -> Redirect to join.php />
You need to split the validation php from the html form stuff and possibly rename inputs for clarity.
Maybe that helps. Regards from Germany
I'm not a pro but my thoughts might help you:
As long as UserSpice uses a PHP-Validation Class and stuff like csrf-tokens, you probably have to use Ajax. As you might have seen, putting login, register and forgot password together in index.php, will cause some php spaghetti. To keep structure and functionality you need JSON aswell.
Example Page: 'login.php'
Without Ajax, the page will get a hard refresh after the submit button is clicked. The php gets executed and validates the input. If the input is invalid, the modal will broke. The error message will be displayed.
With Ajax, login.php will be executed in "background". You're modal won't break, but the action is taking place in "login.php". So, if users input is invalid, you need JSON to get the variables back. With some js and jquery skills it should be possible to not break the site.
Just for security and usability i would keep them by their own path. But that's my opinion. What you can also do:
index.php
->login modal with <form action="login.php"/>
->if validation->passed = Log User in (set in login.php)
->if validation not passed -> Redirect to login.php />
index.php
->register modal with <form action="join.php"/>
->use some live jquery to be sure that user fills out everything and correctly
->if validation->passed = Redirect to success page
->if validation not passed -> Redirect to join.php />
You need to split the validation php from the html form stuff and possibly rename inputs for clarity.
Maybe that helps. Regards from Germany