Welcome Guest, Not a member yet? Register   Sign In
form validation and md5/sha1
#1

[eluser]timaksu[/eluser]
hey guys..for the password field i have this:

Code:
$rules['password']    = "trim|required|min_length[6]|matches[passconf]|sha1";

it technically does what its supposed to until i try to repopulate the form(say, when the passwords don't match). instead of repopulating it with the previously entered password, it uses the sha1'ed version of the password string instead.
#2

[eluser]TheFuzzy0ne[/eluser]
If you don't want it to display that way in the form, then it would probably be wise not to call sha1 as a validation rule. Instead, call it as before you pass the data to your model.
#3

[eluser]Evil Wizard[/eluser]
And I assume your using password fields as input boxes? if so, why repopulate?
#4

[eluser]timaksu[/eluser]
[quote author="Evil Wizard" date="1247585992"]And I assume your using password fields as input boxes? if so, why repopulate?[/quote]

why not? its more convenient. i hate making a mistake on a forum (say, captcha). it reloads the page and asks you to do it again. you do, and submit once more. turns out it did not repopulate the form with your password, and you have to do that again..along with the captcha. happened more than once to me before, and if i can avoid it then why not.

(isnt that really the point of repopulating a form in the first place?
Quote:If you don’t want it to display that way in the form, then it would probably be wise not to call sha1 as a validation rule. Instead, call it as before you pass the data to your model.

what are possible uses for this then? the manual says this is simply another way to prep my data (in other words, "get it ready", yea?). Smile
#5

[eluser]TheFuzzy0ne[/eluser]
Yes, it is another way to prep data. An example of this type of usage might be trim(). That will trim any spaces, and display it in the form without the spaces.
#6

[eluser]timaksu[/eluser]
what about md5/sha1 though? they're effectively useless here?
#7

[eluser]TheFuzzy0ne[/eluser]
Yes, I would say so. Any prepping functions you use in your callbacks, should prep the output in a way you want it to be displayed in your form. Hopefully that make sense?
#8

[eluser]timaksu[/eluser]
yes it does. thanks Smile




Theme © iAndrew 2016 - Forum software by © MyBB