Hi All, I'm working on a private site (ie. all pages are only accessible to logged in users) and I'm trying to figure out if it's best to redirect the user to a login URL or keep the URL as is and display the login form. Here are the 2 scenarios:
1) User requests /resources/list (since it is in the user's history.. maybe bookmarked?). app_controller.php checks that the session variable User.iddoesn't exist so Cake redirects the user to /users/login (ie. URL in the Address/Location bar has now changed to /users/login). This would mean that I'd store all the user validation code inside the users_controller and the User model and I'd have to keep track of what URL was originally requested. OR 2) User requests /resources/list. URL stays as is, but app_controller.php dispatches /users/login and the form action tag points to /resources/list. User enters their login/pass, clicks submit (which points to /resources/list .. as per the form tag) so app_controller.php sees that the user is not logged in but $this->data has a username/password set so app_controller does the validating and sets the right Session variables. The user gets to see the /resources/list page. Also, if the user was entering some data on a page and their session times out, I thought that maybe I could also keep $this->data in memory when the user clicks submit, and set it back to $this->data when they've logged in successfully. I personally like 2) best since I don't have to worry about which page the user requested (as the URL doesn't change), but before I change my code (currently using option 1), I'd like to hear other's opinions on this. Thanks in advance! - Gonzalo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
