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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
47ee5125
Commit
47ee5125
authored
May 04, 2016
by
Andrei Gliga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
validate disabled_oauth_sign_in_sources in ApplicationSe
parent
7c7c5b7e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
app/models/application_setting.rb
app/models/application_setting.rb
+10
-0
spec/models/application_setting_spec.rb
spec/models/application_setting_spec.rb
+3
-0
No files found.
app/models/application_setting.rb
View file @
47ee5125
...
...
@@ -119,6 +119,16 @@ class ApplicationSetting < ActiveRecord::Base
end
end
validates_each
:disabled_oauth_sign_in_sources
do
|
record
,
attr
,
value
|
unless
value
.
nil?
value
.
each
do
|
source
|
unless
Devise
.
omniauth_providers
.
include?
(
source
.
to_sym
)
record
.
errors
.
add
(
attr
,
"'
#{
source
}
' is not an ouath sign-in source"
)
end
end
end
end
before_save
:ensure_runners_registration_token
after_commit
do
...
...
spec/models/application_setting_spec.rb
View file @
47ee5125
...
...
@@ -20,6 +20,9 @@ describe ApplicationSetting, models: true do
it
{
is_expected
.
to
allow_value
(
https
).
for
(
:after_sign_out_path
)
}
it
{
is_expected
.
not_to
allow_value
(
ftp
).
for
(
:after_sign_out_path
)
}
it
{
is_expected
.
to
allow_value
([
:github
]).
for
(
:disabled_oauth_sign_in_sources
)
}
it
{
is_expected
.
not_to
allow_value
([
:test
]).
for
(
:disabled_oauth_sign_in_sources
)
}
it
{
is_expected
.
to
validate_presence_of
(
:max_attachment_size
)
}
it
do
...
...
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