Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Possilbe having email like [email protected]

Eric Guo9a7040ea84e3
diff --git a/app/controllers/concerns/member_helper.rb b/app/controllers/concerns/member_helper.rb
index 701b5b23772..70c7a09a556 100644
--- a/app/controllers/concerns/member_helper.rb
+++ b/app/controllers/concerns/member_helper.rb
@@ -59,7 +59,7 @@ module MemberHelper
def invite_new_users(user_ids, send_notification: true)
user_ids.filter_map do |id|
- if id.to_i == 0 && id.present? # we've got an email - invite that user
+ if id.present? && (id.to_i == 0 || EmailValidator.valid?(id)) # we've got an email - invite that user
# Only users with the create_user permission can add users.
if current_user.allowed_globally?(:create_user) && enterprise_allow_new_users?
# The invitation can pretty much only fail due to the user already
diff --git a/spec/controllers/members_controller_spec.rb b/spec/controllers/members_controller_spec.rb
index bdf02cdaa7b..e96820c3f8d 100644
--- a/spec/controllers/members_controller_spec.rb
+++ b/spec/controllers/members_controller_spec.rb
@@ -164,7 +164,7 @@ RSpec.describe MembersController do
end
context "with yet-to-be-invited emails" do
- let(:emails) { ["[email protected]", "[email protected]"] }
+ let(:emails) { ["[email protected]", "[email protected]"] }
let(:params) do
{
project_id: project.id,