From 03538de3907646bff9a3d2c5bf92bd4183c052ef Mon Sep 17 00:00:00 2001 From: Prommah Date: Thu, 24 Sep 2015 01:32:16 +0100 Subject: [PATCH] Stricter SteamID validation --- app/models/ban.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/ban.rb b/app/models/ban.rb index 44fa7e1..ef68856 100644 --- a/app/models/ban.rb +++ b/app/models/ban.rb @@ -35,7 +35,8 @@ class Ban < ActiveRecord::Base validate :validate_type validate :validate_ventban - validates_format_of :steamid, with: /\A([0-9]{1,10}:){2}[0-9]{1,10}\Z/, allow_blank: true + validates_length_of :steamid, maximum: 14, allow_blank: true + validates_format_of :steamid, with: /\A0:[01]:[0-9]{1,10}\Z/, allow_blank: true validates_format_of :addr, with: /\A([0-9]{1,3}\.){3}[0-9]{1,3}:?[0-9]{0,5}\z/, allow_blank: true validates_length_of :reason, maximum: 255, allow_nil: true, allow_blank: true