diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-12-25 16:46:28 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-12-25 16:46:28 +0200 |
commit | 7fe8d41d88f744b16e6e12c1c07ef3f956994110 (patch) | |
tree | 0efc2685d16b5d49a962d0a232099acdf3e35d70 /app/controllers/oauth | |
parent | a61ccd4ad2d83b2422561a374c300260e5a6d240 (diff) | |
download | gitlab-ce-7fe8d41d88f744b16e6e12c1c07ef3f956994110.tar.gz |
Improve code style
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/controllers/oauth')
-rw-r--r-- | app/controllers/oauth/applications_controller.rb | 14 | ||||
-rw-r--r-- | app/controllers/oauth/authorizations_controller.rb | 11 | ||||
-rw-r--r-- | app/controllers/oauth/authorized_applications_controller.rb | 4 |
3 files changed, 18 insertions, 11 deletions
diff --git a/app/controllers/oauth/applications_controller.rb b/app/controllers/oauth/applications_controller.rb index 8eafe5e3b3d..b53e9662af0 100644 --- a/app/controllers/oauth/applications_controller.rb +++ b/app/controllers/oauth/applications_controller.rb @@ -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
\ No newline at end of file +end diff --git a/app/controllers/oauth/authorizations_controller.rb b/app/controllers/oauth/authorizations_controller.rb index c46707e2c77..72cbbf2e616 100644 --- a/app/controllers/oauth/authorizations_controller.rb +++ b/app/controllers/oauth/authorizations_controller.rb @@ -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 diff --git a/app/controllers/oauth/authorized_applications_controller.rb b/app/controllers/oauth/authorized_applications_controller.rb index b6d4a99c0a9..202421b4abd 100644 --- a/app/controllers/oauth/authorized_applications_controller.rb +++ b/app/controllers/oauth/authorized_applications_controller.rb @@ -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
\ No newline at end of file +end |