Merge branch 'error-when-ldap-doesn-t-supply-an-email-address-14559' into 'master'

Allow temp-oauth-email as notification email

Closes #14559 

/cc @dblessing @rymai 

See merge request !3477
This commit is contained in:
Rémy Coutable 2016-04-01 14:12:42 +00:00
commit f9ab215b21
3 changed files with 10 additions and 0 deletions

View File

@ -20,6 +20,7 @@ v 8.7.0 (unreleased)
v 8.6.3 (unreleased)
- Destroy related todos when an Issue/MR is deleted. !3376
- Fix error 500 when target is nil on todo list. !3376
- Allow temporary email as notification email. !TBD
v 8.6.3
- Fix copying uploads when moving issue to another project

View File

@ -408,6 +408,8 @@ class User < ActiveRecord::Base
end
def owns_notification_email
return if self.temp_oauth_email?
self.errors.add(:notification_email, "is not an email you own") unless self.all_emails.include?(self.notification_email)
end

View File

@ -173,6 +173,13 @@ describe User, models: true do
expect(user).to be_invalid
end
end
context 'owns_notification_email' do
it 'accepts temp_oauth_email emails' do
user = build(:user, email: "temp-email-for-oauth@example.com")
expect(user).to be_valid
end
end
end
end