Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
4a6ec7c9
Commit
4a6ec7c9
authored
Sep 21, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor some controllers to make them EE friendly
parent
f2e9ef10
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
5 deletions
+21
-5
app/controllers/admin/applications_controller.rb
app/controllers/admin/applications_controller.rb
+8
-2
app/controllers/confirmations_controller.rb
app/controllers/confirmations_controller.rb
+5
-1
app/controllers/oauth/applications_controller.rb
app/controllers/oauth/applications_controller.rb
+8
-2
No files found.
app/controllers/admin/applications_controller.rb
View file @
4a6ec7c9
...
@@ -22,8 +22,7 @@ class Admin::ApplicationsController < Admin::ApplicationController
...
@@ -22,8 +22,7 @@ class Admin::ApplicationsController < Admin::ApplicationController
@application
=
Doorkeeper
::
Application
.
new
(
application_params
)
@application
=
Doorkeeper
::
Application
.
new
(
application_params
)
if
@application
.
save
if
@application
.
save
flash
[
:notice
]
=
I18n
.
t
(
:notice
,
scope:
[
:doorkeeper
,
:flash
,
:applications
,
:create
])
redirect_to_admin_page
redirect_to
admin_application_url
(
@application
)
else
else
render
:new
render
:new
end
end
...
@@ -42,6 +41,13 @@ class Admin::ApplicationsController < Admin::ApplicationController
...
@@ -42,6 +41,13 @@ class Admin::ApplicationsController < Admin::ApplicationController
redirect_to
admin_applications_url
,
status:
302
,
notice:
'Application was successfully destroyed.'
redirect_to
admin_applications_url
,
status:
302
,
notice:
'Application was successfully destroyed.'
end
end
protected
def
redirect_to_admin_page
flash
[
:notice
]
=
I18n
.
t
(
:notice
,
scope:
[
:doorkeeper
,
:flash
,
:applications
,
:create
])
redirect_to
admin_application_url
(
@application
)
end
private
private
def
set_application
def
set_application
...
...
app/controllers/confirmations_controller.rb
View file @
4a6ec7c9
...
@@ -12,10 +12,14 @@ class ConfirmationsController < Devise::ConfirmationsController
...
@@ -12,10 +12,14 @@ class ConfirmationsController < Devise::ConfirmationsController
def
after_confirmation_path_for
(
resource_name
,
resource
)
def
after_confirmation_path_for
(
resource_name
,
resource
)
if
signed_in?
(
resource_name
)
if
signed_in?
(
resource_name
)
after_sign_in
_path_for
(
resource
)
after_sign_in
(
resource
)
else
else
flash
[
:notice
]
+=
" Please sign in."
flash
[
:notice
]
+=
" Please sign in."
new_session_path
(
resource_name
)
new_session_path
(
resource_name
)
end
end
end
end
def
after_sign_in
(
resource
)
after_sign_in_path_for
(
resource
)
end
end
end
app/controllers/oauth/applications_controller.rb
View file @
4a6ec7c9
...
@@ -21,14 +21,20 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
...
@@ -21,14 +21,20 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
@application
.
owner
=
current_user
@application
.
owner
=
current_user
if
@application
.
save
if
@application
.
save
flash
[
:notice
]
=
I18n
.
t
(
:notice
,
scope:
[
:doorkeeper
,
:flash
,
:applications
,
:create
])
redirect_to_oauth_application_page
redirect_to
oauth_application_url
(
@application
)
else
else
set_index_vars
set_index_vars
render
:index
render
:index
end
end
end
end
protected
def
redirect_to_oauth_application_page
flash
[
:notice
]
=
I18n
.
t
(
:notice
,
scope:
[
:doorkeeper
,
:flash
,
:applications
,
:create
])
redirect_to
oauth_application_url
(
@application
)
end
private
private
def
verify_user_oauth_applications_enabled
def
verify_user_oauth_applications_enabled
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment