diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-10 15:11:00 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-10 15:11:00 +0300 |
commit | 63c306d96043ff012510358037c19053a2102e8a (patch) | |
tree | bcb2874d81dc9b3748b37d250a83d9a91f8b38b0 /app/models/member.rb | |
parent | 5adf6557e251c047ed68bac28cfecf9491ee6b41 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/member.rb')
-rw-r--r-- | app/models/member.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/member.rb b/app/models/member.rb index e003a5d15db..5b2fe689fcb 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -12,6 +12,7 @@ class Member < ApplicationRecord include Gitlab::Utils::StrongMemoize include FromUnion include UpdateHighestRole + include RestrictedSignup AVATAR_SIZE = 40 ACCESS_REQUEST_APPROVERS_TO_BE_NOTIFIED_LIMIT = 10 @@ -42,6 +43,7 @@ class Member < ApplicationRecord scope: [:source_type, :source_id], allow_nil: true } + validate :signup_email_valid?, on: :create, if: ->(member) { member.invite_email.present? } validates :user_id, uniqueness: { message: _('project bots cannot be added to other groups / projects') @@ -433,6 +435,12 @@ class Member < ApplicationRecord end end + def signup_email_valid? + error = validate_admin_signup_restrictions(invite_email) + + errors.add(:user, error) if error + end + def update_highest_role? return unless user_id.present? |