Improve code style

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2014-12-25 16:46:28 +02:00
parent a61ccd4ad2
commit 7fe8d41d88
No known key found for this signature in database
GPG key ID: 161B5D6A44D3D88A
3 changed files with 18 additions and 11 deletions

View file

@ -8,7 +8,11 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
def create def create
@application = Doorkeeper::Application.new(application_params) @application = Doorkeeper::Application.new(application_params)
@application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?
if Doorkeeper.configuration.confirm_application_owner?
@application.owner = current_user
end
if @application.save if @application.save
flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create]) flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])
redirect_to oauth_application_url(@application) redirect_to oauth_application_url(@application)
@ -18,8 +22,10 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
end end
def destroy def destroy
flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :destroy]) if @application.destroy if @application.destroy
flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :destroy])
end
redirect_to profile_account_url redirect_to profile_account_url
end end
end
end

View file

@ -27,9 +27,9 @@ class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController
private private
def matching_token? def matching_token?
Doorkeeper::AccessToken.matching_token_for pre_auth.client, Doorkeeper::AccessToken.matching_token_for(pre_auth.client,
current_resource_owner.id, current_resource_owner.id,
pre_auth.scopes pre_auth.scopes)
end end
def redirect_or_render(auth) def redirect_or_render(auth)
@ -41,7 +41,8 @@ class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController
end end
def pre_auth def pre_auth
@pre_auth ||= Doorkeeper::OAuth::PreAuthorization.new(Doorkeeper.configuration, @pre_auth ||=
Doorkeeper::OAuth::PreAuthorization.new(Doorkeeper.configuration,
server.client_via_uid, server.client_via_uid,
params) params)
end end
@ -51,7 +52,7 @@ class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController
end end
def strategy def strategy
@strategy ||= server.authorization_request pre_auth.response_type @strategy ||= server.authorization_request(pre_auth.response_type)
end end
end end

View file

@ -2,7 +2,7 @@ class Oauth::AuthorizedApplicationsController < Doorkeeper::AuthorizedApplicatio
layout "profile" layout "profile"
def destroy def destroy
Doorkeeper::AccessToken.revoke_all_for params[:id], current_resource_owner Doorkeeper::AccessToken.revoke_all_for(params[:id], current_resource_owner)
redirect_to profile_account_url, notice: I18n.t(:notice, scope: [:doorkeeper, :flash, :authorized_applications, :destroy]) redirect_to profile_account_url, notice: I18n.t(:notice, scope: [:doorkeeper, :flash, :authorized_applications, :destroy])
end end
end end