about summary refs log tree commit diff
path: root/app/controllers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-03-14 17:49:13 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-03-14 17:49:13 +0100
commit6fec8afc3f91166930c8b4dfca441a5a70a24d5b (patch)
tree4cd02810b87de1dccf7b96630910921d76357921 /app/controllers
parent25d7c1b6eaf03ddaec892c82f7d93a128b79a872 (diff)
Bind oauth applications to users
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/oauth/applications_controller.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/controllers/oauth/applications_controller.rb b/app/controllers/oauth/applications_controller.rb
new file mode 100644
index 000000000..4614ef2f7
--- /dev/null
+++ b/app/controllers/oauth/applications_controller.rb
@@ -0,0 +1,18 @@
+class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
+  before_filter :authenticate_user!
+
+  def index
+    @applications = current_user.oauth_applications
+  end
+
+  def create
+    @application = Doorkeeper::Application.new(application_params)
+    @application.owner = current_user
+
+    if @application.save
+      redirect_to oauth_application_url(@application)
+    else
+      render :new
+    end
+  end
+end