mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 04:31:10 +08:00
Don't try to import invalid websites
This commit is contained in:
@ -1,8 +1,10 @@
|
||||
class UserProfile < ActiveRecord::Base
|
||||
belongs_to :user, inverse_of: :user_profile
|
||||
|
||||
WEBSITE_REGEXP = /(^$)|(^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,9}(([0-9]{1,5})?\/.*)?$)/ix
|
||||
|
||||
validates :bio_raw, length: { maximum: 3000 }
|
||||
validates :website, format: { with: /(^$)|(^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,9}(([0-9]{1,5})?\/.*)?$)/ix }, allow_blank: true
|
||||
validates :website, format: { with: WEBSITE_REGEXP }, allow_blank: true
|
||||
validates :user, presence: true
|
||||
before_save :cook
|
||||
after_save :trigger_badges
|
||||
|
Reference in New Issue
Block a user