applications_controller.rb 794 Bytes
Newer Older
Valery Sizov's avatar
Valery Sizov committed
1
2
3
4
5
6
7
8
9
10
class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
  before_filter :authenticate_user!
  layout "profile"

  def index
    @applications = current_user.oauth_applications
  end

  def create
    @application = Doorkeeper::Application.new(application_params)
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
11
12
13
14
15

    if Doorkeeper.configuration.confirm_application_owner?
      @application.owner = current_user
    end

Valery Sizov's avatar
Valery Sizov committed
16
17
18
19
20
21
22
23
24
    if @application.save
      flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])
      redirect_to oauth_application_url(@application)
    else
      render :new
    end
  end

  def destroy
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
25
26
27
28
    if @application.destroy
      flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :destroy])
    end

Valery Sizov's avatar
Valery Sizov committed
29
30
    redirect_to profile_account_url
  end
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
31
end