users: allow site owner to reset passwords of other users.
This commit is contained in:
@@ -9,7 +9,7 @@ class PasswordsController < ApplicationController
|
||||
def update
|
||||
@user = authorize User.find(params[:user_id]), policy_class: PasswordPolicy
|
||||
|
||||
if @user.authenticate_password(params[:user][:old_password]) || @user.authenticate_login_key(params[:user][:signed_user_id])
|
||||
if @user.authenticate_password(params[:user][:old_password]) || @user.authenticate_login_key(params[:user][:signed_user_id]) || CurrentUser.user.is_owner?
|
||||
@user.update(password: params[:user][:password], password_confirmation: params[:user][:password_confirmation])
|
||||
else
|
||||
@user.errors.add(:base, "Incorrect password")
|
||||
|
||||
Reference in New Issue
Block a user