forked from External/greenlight
Added validation for name: Should not include a http(s) url (#2114)
This commit is contained in:
parent
816cefe1b6
commit
75b989240a
|
@ -35,7 +35,8 @@ class User < ApplicationRecord
|
||||||
|
|
||||||
belongs_to :role, required: false
|
belongs_to :role, required: false
|
||||||
|
|
||||||
validates :name, length: { maximum: 256 }, presence: true
|
validates :name, length: { maximum: 256 }, presence: true,
|
||||||
|
format: { without: %r{https?://}i }
|
||||||
validates :provider, presence: true
|
validates :provider, presence: true
|
||||||
validate :check_if_email_can_be_blank
|
validate :check_if_email_can_be_blank
|
||||||
validates :email, length: { maximum: 256 }, allow_blank: true,
|
validates :email, length: { maximum: 256 }, allow_blank: true,
|
||||||
|
|
|
@ -27,6 +27,7 @@ describe User, type: :model do
|
||||||
context 'validations' do
|
context 'validations' do
|
||||||
it { should validate_presence_of(:name) }
|
it { should validate_presence_of(:name) }
|
||||||
it { should validate_length_of(:name).is_at_most(256) }
|
it { should validate_length_of(:name).is_at_most(256) }
|
||||||
|
it { should_not allow_value("https://www.bigbluebutton.org").for(:name) }
|
||||||
|
|
||||||
it { should validate_presence_of(:provider) }
|
it { should validate_presence_of(:provider) }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue