Removed duplicated code from exemplary validations for password
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user