Removed duplicated code from exemplary validations for password

This commit is contained in:
ecneladis
2014-03-06 19:40:33 +01:00
parent 38584b703d
commit 84fd9503ca
2 changed files with 2 additions and 10 deletions
@@ -70,18 +70,11 @@
<li>1 special character</li>
</p>
<pre class="ruby">
# VALIDATE PASSWORD BOTH AT CREATION AND WHEN UPDATING
validates :password, :presence => true,
:confirmation => true,
:length => {:within => 6..40},
:on => :create,
:if => :password,
:format => {:with => /\A.*(?=.{10,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[\@\#\$\%\^\&\+\=]).*\z/}
validates :password, :presence => true,
:confirmation => true,
:on => :update,
:if => :password,
:format => {:with => /\A.*(?=.{10,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[\@\#\$\%\^\&\+\=]).*\z/}
</pre>
</div>