Welcome Guest, Not a member yet? Register   Sign In
Validation Library and the preservation of slashes
#1

[eluser]jdgiotta[/eluser]
I'm using the Validation library to validate supplied log-in information.
Now part of the requirements for a user name is a domain which relates to a LDAP bind.
For example a user would supply:
foo\jsomebody

However, if the user doesn't supply a password, Validation will kick them back and say "Hey forgot a password". Unfortunately, the backslash is lost making it a pain for the user to re-enter and a great deal of back forth with validation and failed log-ins.

Now I could rework/extend Validation to preserve the slash, but is there a trick that isn't documented so I don't have to go any further if I can avoid it?
#2

[eluser]xwero[/eluser]
I find it strange the backslash is lost. What rules are you using?
#3

[eluser]jdgiotta[/eluser]
Code:
$rules['username']    = "required";
$rules['_password']    = "required";
$this->validation->set_rules($rules);
            
$fields['username']    = 'username';
$fields['_password']    = 'password';
$this->validation->set_fields($fields);
#4

[eluser]xwero[/eluser]
What are you using to repopulate the form?
#5

[eluser]jdgiotta[/eluser]
Code:
<input type="text" name="username" size="20" value="<?=$this->validation->username;?>" />
#6

[eluser]xwero[/eluser]
Ok we found our guilty party. It's the prep_for_form method that has the strip_slashes function. There is no way to solve this without extending the validation library because you do want the friendly name for the input field to appear in the error message.
#7

[eluser]jdgiotta[/eluser]
Ok, thanks for your time.




Theme © iAndrew 2016 - Forum software by © MyBB