Introduce ApiUser.min_password_length

#248
This commit is contained in:
Artur Beljajev 2017-01-08 21:28:21 +02:00
parent 1784980e6c
commit fd58024226
2 changed files with 13 additions and 3 deletions

View file

@ -11,12 +11,16 @@ class ApiUser < User
}
end
def self.min_password_length # Must precede .validates
6
end
# TODO: should have max request limit per day?
belongs_to :registrar
has_many :certificates
validates :username, :password, :registrar, :roles, presence: true
validates :password, length: { minimum: 6 }
validates :password, length: { minimum: min_password_length }
validates :username, uniqueness: true
# TODO: probably cache, because it's requested on every EPP