summaryrefslogtreecommitdiff
path: root/app/controllers/oauth
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-12-25 18:35:04 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-12-25 18:35:04 +0200
commit592e396869ba5dc116cec333733cea8dfbf4a9b5 (patch)
treed673da869a071d7e886491a51ce53c9829207e82 /app/controllers/oauth
parent7fe8d41d88f744b16e6e12c1c07ef3f956994110 (diff)
downloadgitlab-ce-592e396869ba5dc116cec333733cea8dfbf4a9b5.tar.gz
Rework oauth2 feature
* improve UI * add authorization * add separate page for oauth applications Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/controllers/oauth')
-rw-r--r--app/controllers/oauth/applications_controller.rb12
-rw-r--r--app/controllers/oauth/authorizations_controller.rb1
-rw-r--r--app/controllers/oauth/authorized_applications_controller.rb2
3 files changed, 12 insertions, 3 deletions
diff --git a/app/controllers/oauth/applications_controller.rb b/app/controllers/oauth/applications_controller.rb
index b53e9662af0..93201eff303 100644
--- a/app/controllers/oauth/applications_controller.rb
+++ b/app/controllers/oauth/applications_controller.rb
@@ -3,7 +3,7 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
layout "profile"
def index
- @applications = current_user.oauth_applications
+ head :forbidden and return
end
def create
@@ -28,4 +28,14 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
redirect_to profile_account_url
end
+
+ private
+
+ def set_application
+ @application = current_user.oauth_applications.find(params[:id])
+ end
+
+ rescue_from ActiveRecord::RecordNotFound do |exception|
+ render "errors/not_found", layout: "errors", status: 404
+ end
end
diff --git a/app/controllers/oauth/authorizations_controller.rb b/app/controllers/oauth/authorizations_controller.rb
index 72cbbf2e616..a57b4a60c24 100644
--- a/app/controllers/oauth/authorizations_controller.rb
+++ b/app/controllers/oauth/authorizations_controller.rb
@@ -55,4 +55,3 @@ class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController
@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 202421b4abd..0b27ce7da72 100644
--- a/app/controllers/oauth/authorized_applications_controller.rb
+++ b/app/controllers/oauth/authorized_applications_controller.rb
@@ -3,6 +3,6 @@ class Oauth::AuthorizedApplicationsController < Doorkeeper::AuthorizedApplicatio
def destroy
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 applications_profile_url, notice: I18n.t(:notice, scope: [:doorkeeper, :flash, :authorized_applications, :destroy])
end
end