From 276859d0c97128fadeeb8ede2e589acbdeceaeaf Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sun, 4 Mar 2018 10:53:14 +0000 Subject: [PATCH] Validate user location is sensible --- app/models/user.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index d7cd8c8b8..9c99c36a6 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -97,7 +97,8 @@ class User < ActiveRecord::Base validates :email, :if => proc { |u| u.email_changed? }, :uniqueness => { :case_sensitive => false } validates :pass_crypt, :confirmation => true, :length => 8..255 - validates :home_lat, :home_lon, :allow_nil => true, :numericality => true + validates :home_lat, :allow_nil => true, :numericality => true, :inclusion => { :in => -90..90 } + validates :home_lon, :allow_nil => true, :numericality => true, :inclusion => { :in => -180..180 } validates :home_zoom, :allow_nil => true, :numericality => { :only_integer => true } validates :preferred_editor, :inclusion => Editors::ALL_EDITORS, :allow_nil => true validates :image, :attachment_content_type => { :content_type => %r{\Aimage/.*\Z} } -- 2.43.2