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
768008f6
Commit
768008f6
authored
Mar 17, 2016
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Respond to json requests
parent
78530162
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
app/controllers/profiles_controller.rb
app/controllers/profiles_controller.rb
+9
-8
No files found.
app/controllers/profiles_controller.rb
View file @
768008f6
...
@@ -11,15 +11,16 @@ class ProfilesController < Profiles::ApplicationController
...
@@ -11,15 +11,16 @@ class ProfilesController < Profiles::ApplicationController
def
update
def
update
user_params
.
except!
(
:email
)
if
@user
.
ldap_user?
user_params
.
except!
(
:email
)
if
@user
.
ldap_user?
if
@user
.
update_attributes
(
user_params
)
flash
[
:notice
]
=
"Profile was successfully updated"
else
messages
=
@user
.
errors
.
full_messages
.
uniq
.
join
(
'. '
)
flash
[
:alert
]
=
"Failed to update profile.
#{
messages
}
"
end
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
{
redirect_back_or_default
(
default:
{
action:
'show'
})
}
if
@user
.
update_attributes
(
user_params
)
message
=
"Profile was successfully updated"
format
.
html
{
redirect_back_or_default
(
default:
{
action:
'show'
},
options:
{
notice:
message
})
}
format
.
json
{
render
json:
{
message:
message
}
}
else
message
=
@user
.
errors
.
full_messages
.
uniq
.
join
(
'. '
)
format
.
html
{
redirect_back_or_default
(
default:
{
action:
'show'
},
options:
{
alert:
"Failed to update profile.
#{
message
}
"
})
}
format
.
json
{
render
json:
{
message:
message
},
status: :unprocessable_entity
}
end
end
end
end
end
...
...
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