# Setting password

**URL:** <https://www.ruby-forum.com/t/setting-password/124964>\
**Category:** Rails\
**Created:** [January 4, 2008, 3:46am UTC](https://www.ruby-forum.com/t/setting-password/124964 "2008-01-04T03:46:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeffrey\_LSTaylor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ee7513/32.png) [@Jeffrey\_LSTaylor](https://www.ruby-forum.com/u/Jeffrey_LSTaylor)\
**Post date:** [January 4, 2008, 3:46am UTC](https://www.ruby-forum.com/t/setting-password/124964/1 "2008-01-04T03:46:36Z")

</div>

I currently have a form for the user to change password, preferences,  
etc.  
The password field and the confirm password field are initially blank.  
Only  
if there is something entered in the both fields and they match is the  
password changed. However, this prevents the user from using an empty  
password. Admittedly, this isn’t a great idea in general, I am  
reluctant to  
require non-empty passwords. What do others do to allow a user to have  
an  
empty password and not require that they enter the password twice every  
time  
they edit their preferences.

TIA,  
Jeffrey

---

<div class="post-metadata">

**Author:** ![Jeffrey\_LSTaylor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ee7513/32.png) [@Jeffrey\_LSTaylor](https://www.ruby-forum.com/u/Jeffrey_LSTaylor)\
**Post date:** [January 4, 2008, 4:14am UTC](https://www.ruby-forum.com/t/setting-password/124964/2 "2008-01-04T04:14:04Z")

</div>

> I currently have a form for the user to change password, preferences, etc.  
> The password field and the confirm password field are initially blank. Only  
> if there is something entered in the both fields and they match is the  
> password changed. However, this prevents the user from using an empty  
> password. Admittedly, this isn’t a great idea in general, I am reluctant to  
> require non-empty passwords. What do others do to allow a user to have an  
> empty password and not require that they enter the password twice every time  
> they edit their preferences.

Personally I can’t imagine allowing empty passwords for anything, but  
perhaps the simplest and most obvious thing for the user would be to  
have  
a checkbox that read “Set my password to nothing, an empty string, nil,  
zippo, zip, etc…”

If that’s checked, empty their password. Otherwise do the normal thing.

---

<div class="post-metadata">

**Author:** ![Jeffrey\_LSTaylor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ee7513/32.png) [@Jeffrey\_LSTaylor](https://www.ruby-forum.com/u/Jeffrey_LSTaylor)\
**Post date:** [January 4, 2008, 1:31pm UTC](https://www.ruby-forum.com/t/setting-password/124964/3 "2008-01-04T13:31:02Z")

</div>

On Jan 3, 2008, at 8:46 PM, Jeffrey L. Taylor wrote:

> have an  
> empty password and not require that they enter the password twice  
> every time  
> they edit their preferences.

On my profile pages, I have a “Change Password” link that uses a  
different view. I suppose you could also use a hidden div on the  
same page and submit it as a separate form (maybe even ajaxy). That  
way the user can change other profile information without having to  
retype their existing password, which is what I think you were  
referring to.

Peace,  
Phillip
