Skip to content
Snippets Groups Projects
Verified Commit a4ee2f75 authored by Björn Geuken's avatar Björn Geuken Committed by Andrej Shadura
Browse files

[webui] Drop validation of user's email address

Cherry-picked from 1c264f59
parent 63621996
No related branches found
No related tags found
1 merge request!21OBS SSO implementation
...@@ -355,7 +355,7 @@ class User < ActiveRecord::Base ...@@ -355,7 +355,7 @@ class User < ActiveRecord::Base
errors.add(:password_hash_type, 'cannot be changed unless a new password has been provided.') errors.add(:password_hash_type, 'cannot be changed unless a new password has been provided.')
end end
validates :login, :email, :password, :password_hash_type, :state, validates :login, :password, :password_hash_type, :state,
presence: { message: 'must be given' } presence: { message: 'must be given' }
validates :login, validates :login,
...@@ -376,7 +376,8 @@ class User < ActiveRecord::Base ...@@ -376,7 +376,8 @@ class User < ActiveRecord::Base
# to confirm their registration. # to confirm their registration.
validates :email, validates :email,
format: { with: %r{\A([\w\-\.\#\$%&!?*\'\+=(){}|~]+)@([0-9a-zA-Z\-\.\#\$%&!?*\'=(){}|~]+)+\z}, format: { with: %r{\A([\w\-\.\#\$%&!?*\'\+=(){}|~]+)@([0-9a-zA-Z\-\.\#\$%&!?*\'=(){}|~]+)+\z},
message: 'must be a valid email address.' } message: 'must be a valid email address.',
allow_blank: true }
# We want to validate the format of the password and only allow alphanumeric # We want to validate the format of the password and only allow alphanumeric
# and some punctiation characters. # and some punctiation characters.
......
...@@ -10,7 +10,6 @@ RSpec.describe User do ...@@ -10,7 +10,6 @@ RSpec.describe User do
it { is_expected.to validate_length_of(:login).is_at_least(2).with_message('must have more than two characters.') } it { is_expected.to validate_length_of(:login).is_at_least(2).with_message('must have more than two characters.') }
it { is_expected.to validate_length_of(:login).is_at_most(100).with_message('must have less than 100 characters.') } it { is_expected.to validate_length_of(:login).is_at_most(100).with_message('must have less than 100 characters.') }
it { is_expected.to validate_presence_of(:email).with_message('must be given') }
it { is_expected.to allow_value('king@opensuse.org').for(:email) } it { is_expected.to allow_value('king@opensuse.org').for(:email) }
it { is_expected.to_not allow_values('king.opensuse.org', 'opensuse.org', 'opensuse').for(:email) } it { is_expected.to_not allow_values('king.opensuse.org', 'opensuse.org', 'opensuse').for(:email) }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment