update password using current password in rails

Viewed 39

hello guys I am using password controller and I have a method

def update
      if @current_user.present? && @current_user.authenticate(:password)
        if @current_user.update(password_param)      
          if @current_user.role.name == "admin"
            redirect_to admin_path, notice: 'password reset in successfully'
            
          else 
            redirect_to show_path, notice: 'password reset in successfully'
          end
        end
      end

The problem is when I am using this following code then only I get an error while I am checking @current_user.authenticate(:password) but remaining is correct and is working please help me I am new to rails. and here is my console error --

No template found for PasswordsController#update, rendering head :no_content
Completed 204 No Content in 229ms (ActiveRecord: 1.2ms | Allocations: 10958)
0 Answers
Related