summaryrefslogtreecommitdiff
path: root/app/controllers/profiles_controller.rb
diff options
context:
space:
mode:
authorMark Fletcher <mark@gitlab.com>2017-02-28 22:44:57 +0530
committerMark Fletcher <mark@gitlab.com>2017-03-02 12:33:06 +0530
commit4c3412c37586b624585732326714a605bb226ba9 (patch)
tree3a0a42c1192cc919370b05be75d297a4376e8ec1 /app/controllers/profiles_controller.rb
parent7733f285aca97d444382a59eda0ea3e303539c26 (diff)
downloadgitlab-ce-4c3412c37586b624585732326714a605bb226ba9.tar.gz
Update profiles/account view to display new username
Diffstat (limited to 'app/controllers/profiles_controller.rb')
-rw-r--r--app/controllers/profiles_controller.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb
index f0c71725ea8..987b95e89b9 100644
--- a/app/controllers/profiles_controller.rb
+++ b/app/controllers/profiles_controller.rb
@@ -47,11 +47,14 @@ class ProfilesController < Profiles::ApplicationController
end
def update_username
- @user.update_attributes(username: user_params[:username])
-
- respond_to do |format|
- format.js
+ if @user.update_attributes(username: user_params[:username])
+ options = { notice: "Username successfully changed" }
+ else
+ message = @user.errors.full_messages.uniq.join('. ')
+ options = { alert: "Username change failed - #{message}" }
end
+
+ redirect_back_or_default(default: { action: 'show' }, options: options)
end
private