Class: Doorkeeper::DeviceAuthorizationGrant::DeviceAuthorizationsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Doorkeeper::DeviceAuthorizationGrant::DeviceAuthorizationsController
- Defined in:
- app/controllers/doorkeeper/device_authorization_grant/device_authorizations_controller.rb
Overview
The Device Authorizations controller provides a simple interface which allows authenticated resource owners to authorize devices, by providing a user code.
Instance Method Summary collapse
Instance Method Details
#authorize ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/doorkeeper/device_authorization_grant/device_authorizations_controller.rb', line 18 def device_grant_model.transaction do device_grant = device_grant_model.lock.find_by(user_code: user_code) next (:invalid_user_code) if device_grant.nil? next (:expired_user_code) if device_grant.expired? device_grant.update!(user_code: nil, resource_owner_id: current_resource_owner.id) end end |
#index ⇒ Object
11 12 13 14 15 16 |
# File 'app/controllers/doorkeeper/device_authorization_grant/device_authorizations_controller.rb', line 11 def index respond_to do |format| format.html format.json { head :no_content } end end |