Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b6e9249a
Commit
b6e9249a
authored
Aug 04, 2020
by
peterhegman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename regex constant to VALID_DOMAIN_REGEX
Per reviewer feedback
parent
142ec0a5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
ee/app/models/allowed_email_domain.rb
ee/app/models/allowed_email_domain.rb
+2
-2
ee/app/views/groups/settings/_allowed_email_domain.html.haml
ee/app/views/groups/settings/_allowed_email_domain.html.haml
+1
-1
No files found.
ee/app/models/allowed_email_domain.rb
View file @
b6e9249a
...
@@ -14,14 +14,14 @@ class AllowedEmailDomain < ApplicationRecord
...
@@ -14,14 +14,14 @@ class AllowedEmailDomain < ApplicationRecord
'icloud.com'
'icloud.com'
].
freeze
].
freeze
REGEX_VALIDATOR
=
/\w*\./
.
freeze
VALID_DOMAIN_REGEX
=
/\w*\./
.
freeze
validates
:group_id
,
presence:
true
validates
:group_id
,
presence:
true
validates
:domain
,
presence:
true
validates
:domain
,
presence:
true
validate
:allow_root_group_only
validate
:allow_root_group_only
validates
:domain
,
exclusion:
{
in:
RESERVED_DOMAINS
,
validates
:domain
,
exclusion:
{
in:
RESERVED_DOMAINS
,
message:
_
(
'The domain you entered is not allowed.'
)
}
message:
_
(
'The domain you entered is not allowed.'
)
}
validates
:domain
,
format:
{
with:
REGEX_VALIDATOR
,
validates
:domain
,
format:
{
with:
VALID_DOMAIN_REGEX
,
message:
_
(
'The domain you entered is misformatted.'
)
}
message:
_
(
'The domain you entered is misformatted.'
)
}
belongs_to
:group
,
class_name:
'Group'
,
foreign_key: :group_id
belongs_to
:group
,
class_name:
'Group'
,
foreign_key: :group_id
...
...
ee/app/views/groups/settings/_allowed_email_domain.html.haml
View file @
b6e9249a
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
=
_
(
'Restrict membership by email domain'
)
=
_
(
'Restrict membership by email domain'
)
.js-allowed-email-domains
{
data:
{
hidden_input_id:
hidden_input_id
,
.js-allowed-email-domains
{
data:
{
hidden_input_id:
hidden_input_id
,
label_id:
label_id
,
label_id:
label_id
,
regex_validator:
AllowedEmailDomain
::
REGEX_VALIDATOR
.
source
,
regex_validator:
AllowedEmailDomain
::
VALID_DOMAIN_REGEX
.
source
,
disallowed_values:
AllowedEmailDomain
::
RESERVED_DOMAINS
.
to_json
,
disallowed_values:
AllowedEmailDomain
::
RESERVED_DOMAINS
.
to_json
,
error_message:
_
(
'The domain you entered is misformatted.'
),
error_message:
_
(
'The domain you entered is misformatted.'
),
disallowed_value_error_message:
_
(
'The domain you entered is not allowed.'
)
}
}
disallowed_value_error_message:
_
(
'The domain you entered is not allowed.'
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment