R
R
Rustem Saifullin2020-10-24 12:49:16
Java
Rustem Saifullin, 2020-10-24 12:49:16

How to set an action after authorization?

I'm doing a project on Servlets. Let's say the user added something to his basket, and the server checks whether he is authorized, if not, sends him to the authorization page. And the question is how to make sure that after successful authorization this product is added to the cart?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2020-10-24
@i_rustem

Save somewhere the identifier of the desired action and execute it after authorization.
For example, I follow the link /profile/settings
I am not authorized and redirects me to /login, adding the parameter /login?redirect=/profile/settings
to the URL After authorization, we look at the URL and if there is a redirect parameter, then redirect to the right place.
With a basket, you can write in cookies, well, or wherever your imagination will indicate.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question