Bind oauth applications to users
This commit is contained in:
parent
25d7c1b6ea
commit
6fec8afc3f
12 changed files with 69 additions and 3 deletions
3
app/assets/javascripts/oauth/applications.coffee
Normal file
3
app/assets/javascripts/oauth/applications.coffee
Normal 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/
|
|
@ -247,6 +247,12 @@
|
|||
input[type=file] {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.hint {
|
||||
display: block;
|
||||
margin-top: 5px;
|
||||
color: lighten(#282c37, 25%);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
3
app/assets/stylesheets/oauth/applications.scss
Normal file
3
app/assets/stylesheets/oauth/applications.scss
Normal 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/
|
18
app/controllers/oauth/applications_controller.rb
Normal file
18
app/controllers/oauth/applications_controller.rb
Normal 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
|
2
app/helpers/oauth/applications_helper.rb
Normal file
2
app/helpers/oauth/applications_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module Oauth::ApplicationsHelper
|
||||
end
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue