From ca01c4c6484aa135234028e5e1ca5829adad1a50 Mon Sep 17 00:00:00 2001 From: Paco Guzman Date: Thu, 16 Jun 2016 12:53:32 +0200 Subject: Remove Duplicated keys add UNIQUE index to fingerprint --- app/models/key.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/models/key.rb') diff --git a/app/models/key.rb b/app/models/key.rb index 0532e84f47d..b9bc38a0436 100644 --- a/app/models/key.rb +++ b/app/models/key.rb @@ -9,7 +9,7 @@ class Key < ActiveRecord::Base before_validation :strip_white_space, :generate_fingerprint validates :title, presence: true, length: { within: 0..255 } - validates :key, presence: true, length: { within: 0..5000 }, format: { with: /\A(ssh|ecdsa)-.*\Z/ }, uniqueness: true + validates :key, presence: true, length: { within: 0..5000 }, format: { with: /\A(ssh|ecdsa)-.*\Z/ } validates :key, format: { without: /\n|\r/, message: 'should be a single line' } validates :fingerprint, uniqueness: true, presence: { message: 'cannot be generated' } -- cgit v1.2.3