diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 0e6cf741f2..b797fc9ba2 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -53,8 +53,8 @@ def reset_user_password PasswordResetMailer.reset_notify(user, key).deliver_now unless user.nil? # respond the same to both successes and failures; security end - flash[:notice] = "#{user.name} should receive an email with instructions on how to reset their password. If they do not, please double check that they are using the email they registered with." - redirect_to "/profile/" + user.name + flash[:notice] = "#{user.name} should receive an email with instructions on how to reset their password. If they do not, please double check that they are using the email they registered with." + redirect_to URI.parse("/profile/" + user.name).path end end diff --git a/app/controllers/relationships_controller.rb b/app/controllers/relationships_controller.rb index c704149c16..d8ed140b70 100644 --- a/app/controllers/relationships_controller.rb +++ b/app/controllers/relationships_controller.rb @@ -4,7 +4,7 @@ class RelationshipsController < ApplicationController def create user = User.find(params[:followed_id]) current_user.follow(user) - redirect_to "/profile/#{user.username}" + redirect_to URI.parse("/profile/#{user.username}").path end def destroy diff --git a/app/controllers/user_tags_controller.rb b/app/controllers/user_tags_controller.rb index 960bf02b78..7cac31c03c 100644 --- a/app/controllers/user_tags_controller.rb +++ b/app/controllers/user_tags_controller.rb @@ -20,7 +20,7 @@ def create @output[:errors] << I18n.t('user_tags_controller.tag_already_exists') exist = true end - + unless exist user_tag = user.user_tags.build(value: name) if user_tag.save @@ -45,7 +45,7 @@ def create else flash[:notice] = I18n.t('user_tags_controller.tag_created', tag_name: @output[:saved][0][0]).html_safe end - redirect_to '/profile/' + user.username + redirect_to URI.parse('/profile/' + user.username).path end end @@ -56,15 +56,15 @@ def delete } message = '' - begin + begin @user_tag = UserTag.where(uid: params[:id], value: params[:name]) if(!@user_tag.nil?) - @user_tag = @user_tag.first - end - + @user_tag = @user_tag.first + end + if current_user.role == 'admin' || params[:id].to_i == current_user.id if (!@user_tag.nil? && @user_tag.user == current_user) || (!@user_tag.nil? && current_user.role == 'admin') - UserTag.where(uid: params[:id] , value: params[:name]).destroy_all + UserTag.where(uid: params[:id] , value: params[:name]).destroy_all message = I18n.t('user_tags_controller.tag_deleted') output[:status] = true else