summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMrYummy <elemental428@gmail.com>2017-07-11 03:59:19 +0200
committerMrYummy <elemental428@gmail.com>2017-07-11 03:59:19 +0200
commit5f17385343a357ab8beb2546bd7eee55b1e84567 (patch)
treec6aacfded45fc0099464c2e014da2ddf189c1d1c
parent2819989b72a38e30192cd57661bde89bc1ebfc7c (diff)
Fixed error when a user sets their name to that of another
-rw-r--r--app/controllers/users_controller.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 3d49591..315b767 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -141,6 +141,11 @@ class UsersController < ApplicationController
else
userdata = user_params([:name, :skype, :skype_public, :youtube, :twitter, :about, :header_scroll, :utc_time, :dark])
end
+ if User.find_by(name: userdata[:name])
+ flash[:alert] = "You have entered a name that belongs to someone else. Please try another."
+ redirect_to edit_user_path(@user)
+ return
+ end
if userdata[:role]
role = Role.get(userdata[:role])
if role && role <= current_user.role