summaryrefslogtreecommitdiff
path: root/app/controllers
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
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')
-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
-rw-r--r--app/controllers/profiles/accounts_controller.rb2
-rw-r--r--app/controllers/profiles_controller.rb5
5 files changed, 17 insertions, 5 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
diff --git a/app/controllers/profiles/accounts_controller.rb b/app/controllers/profiles/accounts_controller.rb
index 5f15378c831..fe121691a10 100644
--- a/app/controllers/profiles/accounts_controller.rb
+++ b/app/controllers/profiles/accounts_controller.rb
@@ -3,7 +3,5 @@ class Profiles::AccountsController < ApplicationController
def show
@user = current_user
- @applications = current_user.oauth_applications
- @authorized_applications = Doorkeeper::Application.authorized_for(current_user)
end
end
diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb
index e877f9b9049..c0b7e2223a2 100644
--- a/app/controllers/profiles_controller.rb
+++ b/app/controllers/profiles_controller.rb
@@ -13,6 +13,11 @@ class ProfilesController < ApplicationController
def design
end
+ def applications
+ @applications = current_user.oauth_applications
+ @authorized_tokens = current_user.oauth_authorized_tokens
+ end
+
def update
user_params.except!(:email) if @user.ldap_user?