Welcome Guest, Not a member yet? Register   Sign In
Call model-class from view
#41

[eluser]TheFuzzy0ne[/eluser]
You mean you want to return your user to the page they were viewing before they logged in?

There are lots of ways to do this, but my favourites are to have a login box at the top of the page, and that form can contain a hidden input for storing the URI string ($this->uri->uri_string()), or you can use $this->input->server('REFERER') to set the login return, but you'll need to add some logic to ensure that if the login fails, the return URI is not overwritten with the URI for the login controller. I should also point out that with this method, it might not work as planned if the user followed a link on another Web site to your login page. So you'd need to add some validation in there to ensure they aren't returned back to that site after being logged in.
#42

[eluser]juan1904[/eluser]
[quote author="TheFuzzy0ne" date="1242499079"]You mean you want to return your user to the page they were viewing before they logged in?

There are lots of ways to do this, but my favourites are to have a login box at the top of the page, and that form can contain a hidden input for storing the URI string ($this->uri->uri_string()), or you can use $this->input->server('REFERER') to set the login return, but you'll need to add some logic to ensure that if the login fails, the return URI is not overwritten with the URI for the login controller. I should also point out that with this method, it might not work as planned if the user followed a link on another Web site to your login page. So you'd need to add some validation in there to ensure they aren't returned back to that site after being logged in.[/quote]

Yes, that's excatly what I am trying to do! Right now my solution to this is to use redirect to get them back. But when the login fails I still want to return the user to the page they were viewing before but with an error message using validation_error() in the form_validation-library. But if I use redirect when the login fails the error message will not appear.

Are there any good solution for the error message-problem?
#43

[eluser]TheFuzzy0ne[/eluser]
Yes, you can use flashdata if you're going to redirect then the error message will be available for that request, but surely you'd be better off redirecting the user to the main login page on failure?




Theme © iAndrew 2016 - Forum software by © MyBB