Commit 7fe8d41d authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Improve code style

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent a61ccd4a
...@@ -8,7 +8,11 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController ...@@ -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 ...@@ -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
\ No newline at end of file
...@@ -27,9 +27,9 @@ class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController ...@@ -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 ...@@ -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 ...@@ -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
...@@ -2,7 +2,7 @@ class Oauth::AuthorizedApplicationsController < Doorkeeper::AuthorizedApplicatio ...@@ -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
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment