Class: JwtAuthEngine::PasswordsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/jwt_auth_engine/passwords_controller.rb

Overview

Handles password rotation for authenticated users.

Instance Method Summary collapse

Methods included from ResponseRenderable

#render_internal_server_error, #render_success, #render_unauthorized, #render_validation_error

Instance Method Details

#change_passwordObject

── POST /change_password ─────────────────────────────────────────────────



7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/jwt_auth_engine/passwords_controller.rb', line 7

def change_password
  result = ChangePasswordService.new(
    auth_model_instance: current_auth_model_instance,
    change_password_params: change_password_params
  ).call

  return render_success(message: result[:message]) if result[:success]

  return render_unauthorized(result[:invalid]) if result[:invalid]

  render_validation_error(errors: result[:errors])
end