login issue

I am working on a project with an idea that might seem suspicious to some. In short, I have encountered a problem. The project is based on the premise that when the user enters their email and password, this data is sent to the admin dashboard. The admin then verifies them and either approves or disapproves. If approved, the user is redirected to a page also specified by the admin. I have searched for various solutions, but some suggest that it is possible if the user presses "login" twice or if I perform control on the user's browser console. However, these solutions are not helpful. Is there any other solution? I would appreciate your assistance as soon as possible.🥺
8 Replies
StefanH
StefanH•11mo ago
How quickly do you expect your admins to respond? You can't expect users to have their browser open for days Getting servers to push data to a client is always a bit trickier on the web. Best way you can do that is via web sockets but those connections are more expensive and need to be constantly online
mona Salih
mona Salih•11mo ago
What I want is for the user to stay in the login page, awaiting approval or disapproval from the admin, until the admin accepts. Additionally, the admin should specify the page to which the user will be redirected.
Jochem
Jochem•11mo ago
what possible use case does that have? but yeah, either you use websockets or you have the user's browser poll the server occasionally using fetch
mona Salih
mona Salih•11mo ago
Can you help me with the way this is done?
Jochem
Jochem•11mo ago
I have no experience using websockets, which is probably the best solution. The other one, you create an endpoint on your server that either returns false or the URL to redirect to based on a token you set during the initial login request, then put a fetch in a setInterval that checks every couple of seconds to see if the endpoint returns the URL yet. When it does, it redirects, otherwise it just tries again in a few seconds. if you get stuck implementing either, feel free to post a new question, but I can't build it for you
mona Salih
mona Salih•11mo ago
I desire to expound my predicament succinctly as follows: When the user enters the information, they will press "Login." This information is then sent to the admin page. The admin determines whether to approve or reject it. If approved, the admin also specifies where the user will go, meaning which page. In the meantime, the user remains on the same login page, waiting until the admin decides.
StefanH
StefanH•11mo ago
Are you building some kind of embedded system? I really wouldn't build this otherwise If it's a normal web app this is pretty unpractical This is also a full stack project. It's difficult to help without knowing what your backend looks like Do you already have the admin panel built? This is a whole project, not a little code snippet we can share
mona Salih
mona Salih•11mo ago
I am currently enrolled in a comprehensive Full Stack training program, where we have been assigned multiple projects, and this is one of them. Would it be possible to receive your assistance?
Want results from more Discord servers?
Add your server
More Posts