# Validate size of but for encrypted password

**URL:** <https://www.ruby-forum.com/t/validate-size-of-but-for-encrypted-password/147175>\
**Category:** Rails\
**Created:** [August 29, 2008, 3:23am UTC](https://www.ruby-forum.com/t/validate-size-of-but-for-encrypted-password/147175 "2008-08-29T03:23:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ReK2SS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c89c15/32.png) [@ReK2SS](https://www.ruby-forum.com/u/ReK2SS)\
**Post date:** [August 29, 2008, 3:23am UTC](https://www.ruby-forum.com/t/validate-size-of-but-for-encrypted-password/147175/1 "2008-08-29T03:23:21Z")

</div>

Hi, I am wondering how people will validate the size of a password  
field…  
when I use validate\_size\_of it always pass because the encrypted  
password is almost longer than 8 characters…  
so how does people force users to enter a 8 char password?

Thanks.

---

<div class="post-metadata">

**Author:** ![ReK2SS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c89c15/32.png) [@ReK2SS](https://www.ruby-forum.com/u/ReK2SS)\
**Post date:** [August 29, 2008, 6:50am UTC](https://www.ruby-forum.com/t/validate-size-of-but-for-encrypted-password/147175/2 "2008-08-29T06:50:22Z")

</div>

Wite an javascript function which would force the user to enter  
atleast 8 charachters…

On Aug 29, 6:21 am, “ReK2-…-…-…----\>” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![ReK2SS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c89c15/32.png) [@ReK2SS](https://www.ruby-forum.com/u/ReK2SS)\
**Post date:** [August 29, 2008, 12:47pm UTC](https://www.ruby-forum.com/t/validate-size-of-but-for-encrypted-password/147175/3 "2008-08-29T12:47:57Z")

</div>

Hi, you’re actually validating the input to your application instead of  
the  
representation in your database. You’re correct in saying the encrypted  
password is longer than the input entered by the user. Next, I would  
only  
check the length of the password in the following scenarios:  
o user registration/creation  
o user password change/reset

Otherwise, you shouldn’t be checking the length of the password.

Good luck,

-Conrad

On Thu, Aug 28, 2008 at 6:21 PM, ReK2-…-…-…----\> \<
