More strict validation for SSH Key content

This commit is contained in:
Dmitriy Zaporozhets 2013-05-13 11:59:30 +03:00
parent 6e1ee1fea6
commit 5b5ff7708b
1 changed files with 1 additions and 1 deletions

View File

@ -22,7 +22,7 @@ class Key < ActiveRecord::Base
before_validation :strip_white_space
validates :title, presence: true, length: { within: 0..255 }
validates :key, presence: true, length: { within: 0..5000 }, format: { with: /ssh-.{3} / }, uniqueness: true
validates :key, presence: true, length: { within: 0..5000 }, format: { with: /\Assh-.*\Z/ }, uniqueness: true
validate :fingerprintable_key
delegate :name, :email, to: :user, prefix: true