Improve code style
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
a61ccd4ad2
commit
7fe8d41d88
3 changed files with 18 additions and 11 deletions
|
@ -8,7 +8,11 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
|
|||
|
||||
def create
|
||||
@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
|
||||
flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])
|
||||
redirect_to oauth_application_url(@application)
|
||||
|
@ -18,8 +22,10 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
|
|||
end
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -27,9 +27,9 @@ class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController
|
|||
private
|
||||
|
||||
def matching_token?
|
||||
Doorkeeper::AccessToken.matching_token_for pre_auth.client,
|
||||
current_resource_owner.id,
|
||||
pre_auth.scopes
|
||||
Doorkeeper::AccessToken.matching_token_for(pre_auth.client,
|
||||
current_resource_owner.id,
|
||||
pre_auth.scopes)
|
||||
end
|
||||
|
||||
def redirect_or_render(auth)
|
||||
|
@ -41,7 +41,8 @@ class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController
|
|||
end
|
||||
|
||||
def pre_auth
|
||||
@pre_auth ||= Doorkeeper::OAuth::PreAuthorization.new(Doorkeeper.configuration,
|
||||
@pre_auth ||=
|
||||
Doorkeeper::OAuth::PreAuthorization.new(Doorkeeper.configuration,
|
||||
server.client_via_uid,
|
||||
params)
|
||||
end
|
||||
|
@ -51,7 +52,7 @@ class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController
|
|||
end
|
||||
|
||||
def strategy
|
||||
@strategy ||= server.authorization_request pre_auth.response_type
|
||||
@strategy ||= server.authorization_request(pre_auth.response_type)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ class Oauth::AuthorizedApplicationsController < Doorkeeper::AuthorizedApplicatio
|
|||
layout "profile"
|
||||
|
||||
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])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue