0
0
Fork 0

Bind oauth applications to users

This commit is contained in:
Eugen Rochko 2016-03-14 17:49:13 +01:00
parent 25d7c1b6ea
commit 6fec8afc3f
12 changed files with 69 additions and 3 deletions

View file

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View file

@ -247,6 +247,12 @@
input[type=file] {
display: block;
}
.hint {
display: block;
margin-top: 5px;
color: lighten(#282c37, 25%);
}
}
}

View file

@ -0,0 +1,3 @@
// Place all the styles related to the oauth::applications controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View file

@ -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

View file

@ -0,0 +1,2 @@
module Oauth::ApplicationsHelper
end

View file

@ -5,4 +5,6 @@ class User < ActiveRecord::Base
accepts_nested_attributes_for :account
validates :account, presence: true
has_many :oauth_applications, class_name: 'Doorkeeper::Application', as: :owner
end