Welcome Guest, Not a member yet? Register   Sign In
Validating logins -- how to display error?
#1

[eluser]jwag[/eluser]
Hello,

I have a question about the best way to go about validating user logins. It's a standard username/password input.

In my login() function, I am using the form_validation helper to verify that both are input, and another verifying that a "." exists in the username (our usernames here are all firstname.lastname, after switching from lastnamef where f = first initial, it's important to remind users not to use their old account).

Now, I need to do two things...

Use adLDAP to verify logins. This is working! And I have it properly redirecting in to the control panel if the un/pw combination was valid. But I'm not sure how to redirect back if it was invalid.

I could use show_error(), but I'd really like to redirect them back to the login screen (the view file is admin.php) and display the error above the login form, similar to how I can with form_validation's validation_error() function. Or maybe I'm just missing something obvious with show_error().

I was just wondering if there was an easier way that redirecting them to a URL with a specific query string. I remember in Ruby on Rails you could do something like flash[:error]. I'm new to CodeIgniter, and wasn't sure if something similar was implemented.

Thank you for any help you can provide!



EDIT: Nevermind, I discovered flashdata...I somehow missed it when I was looking at the session library.




Theme © iAndrew 2016 - Forum software by © MyBB