diff options
author | MrYummy <elemental428@gmail.com> | 2017-07-11 03:59:19 +0200 |
---|---|---|
committer | MrYummy <elemental428@gmail.com> | 2017-07-11 03:59:19 +0200 |
commit | 5f17385343a357ab8beb2546bd7eee55b1e84567 (patch) | |
tree | c6aacfded45fc0099464c2e014da2ddf189c1d1c /app | |
parent | 2819989b72a38e30192cd57661bde89bc1ebfc7c (diff) |
Fixed error when a user sets their name to that of another
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/users_controller.rb | 5 |
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 |