diff options
| author | mo khan <mo@mokhan.ca> | 2014-09-17 21:30:57 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-09-17 21:30:57 -0600 |
| commit | 0cc3de2769769be786a679975ae329e98462fcc4 (patch) | |
| tree | 88824cf1c9757f26e52ed8d6bed28e6bf4baad4c /app | |
| parent | cda9d573bf273eaafa213c06543c071841041306 (diff) | |
add password validation.
Diffstat (limited to 'app')
| -rw-r--r-- | app/models/user.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 30b3fecd..c455162a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -16,6 +16,7 @@ class User < ActiveRecord::Base validates :name, :presence => true validates :email, presence: true, uniqueness: true, email: true validates :website, :format => URI::regexp(%w(http https)), :allow_blank => true + validates :password, length: { in: 6..20 } #devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :token_authenticatable has_many :creations, :dependent => :destroy @@ -47,7 +48,7 @@ class User < ActiveRecord::Base end def password - @password ||= Password.new(password_hash) + @password ||= Password.new(encrypted_password) end def password=(new_password) |
