Class: ApiGuard::PasswordsController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#authenticate_resource

Instance Method Details

#updateObject



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

def update
  invalidate_old_jwt_tokens(current_resource)

  if current_resource.update_attributes(password_params)
    blacklist_token unless ApiGuard.invalidate_old_tokens_on_password_change
    destroy_all_refresh_tokens(current_resource)

    create_token_and_set_header(current_resource, resource_name)
    render_success(message: I18n.t('api_guard.password.changed'))
  else
    render_error(422, object: current_resource)
  end
end