From 5afb16e4965e41af420211fa35bff0d2d0a07de7 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 29 Aug 2012 07:13:29 +0300 Subject: [PATCH] Add ssh key validation --- app/models/key.rb | 1 + spec/factories.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/key.rb b/app/models/key.rb index 8b61675a444..3890814cecf 100644 --- a/app/models/key.rb +++ b/app/models/key.rb @@ -10,6 +10,7 @@ class Key < ActiveRecord::Base validates :key, presence: true, + :format => { :with => /ssh-.{3} / }, length: { within: 0..5000 } before_save :set_identifier diff --git a/spec/factories.rb b/spec/factories.rb index 929f9295947..3f9673b499e 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -77,7 +77,7 @@ FactoryGirl.define do title key do """ - AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4 + ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4 596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4 soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0= """