Class: Oauth::ApplicationsController

Inherits:
Doorkeeper::ApplicationsController
  • Object
show all
Defined in:
app/controllers/oauth/applications_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

only needed if each application must have some owner


12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/oauth/applications_controller.rb', line 12

def create
  @application       = Doorkeeper::Application.new(application_params)
  @application.uid   = SecureRandom.hex(4)
  @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?

  if @application.save
    flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])
    redirect_to oauth_application_url(@application)
  else
    render :new
  end
end

#indexObject


5
6
7
8
9
# File 'app/controllers/oauth/applications_controller.rb', line 5

def index
  @applications = current_user.oauth_applications
  @authorized_applications = Doorkeeper::Application.authorized_for(current_user)
  @devices = current_user.devices.all
end