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
1e75c7db
Commit
1e75c7db
authored
Oct 04, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reset Jenkins password if username was left blank
Closes
https://gitlab.com/gitlab-org/gitlab-ce/issues/22430
parent
b200d112
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
app/models/project_services/jenkins_service.rb
app/models/project_services/jenkins_service.rb
+2
-2
app/views/shared/_field.html.haml
app/views/shared/_field.html.haml
+6
-5
No files found.
app/models/project_services/jenkins_service.rb
View file @
1e75c7db
...
...
@@ -24,7 +24,7 @@ class JenkinsService < CiService
before_update
:reset_password
validates
:username
,
presence:
true
,
if:
->
(
service
)
{
service
.
activated?
&&
service
.
password
.
present
?
}
if:
->
(
service
)
{
service
.
activated?
&&
service
.
password
_touched
?
}
default_value_for
:push_events
,
true
default_value_for
:merge_requests_events
,
false
...
...
@@ -34,7 +34,7 @@ class JenkinsService < CiService
def
reset_password
# don't reset the password if a new one is provided
if
jenkins_url_changed?
&&
!
password_touched?
if
(
jenkins_url_changed?
||
username
.
blank?
)
&&
!
password_touched?
self
.
password
=
nil
end
end
...
...
app/views/shared/_field.html.haml
View file @
1e75c7db
...
...
@@ -13,15 +13,16 @@
-
else
=
form
.
label
name
,
title
,
class:
"control-label"
.col-sm-10
-
if
type
==
'text'
-
case
type
-
when
'text'
=
form
.
text_field
name
,
class:
"form-control"
,
placeholder:
placeholder
-
elsif
type
==
'textarea'
-
when
'textarea'
=
form
.
text_area
name
,
rows:
5
,
class:
"form-control"
,
placeholder:
placeholder
-
elsif
type
==
'checkbox'
-
when
'checkbox'
=
form
.
check_box
name
-
elsif
type
==
'select'
-
when
'select'
=
form
.
select
name
,
options_for_select
(
choices
,
value
?
value
:
default_choice
),
{},
{
class:
"form-control"
}
-
elsif
type
==
'password'
-
when
'password'
=
form
.
password_field
name
,
autocomplete:
"new-password"
,
class:
'form-control'
-
if
help
%span
.help-block
=
help
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