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
Boxiang Sun
gitlab-ce
Commits
49c9e8ec
Commit
49c9e8ec
authored
Jun 24, 2014
by
Marin Jankovski
Committed by
Dmitriy Zaporozhets
Jun 24, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use an error page when oauth fails.
parent
f40e87a0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
app/controllers/omniauth_callbacks_controller.rb
app/controllers/omniauth_callbacks_controller.rb
+7
-1
config/routes.rb
config/routes.rb
+3
-0
No files found.
app/controllers/omniauth_callbacks_controller.rb
View file @
49c9e8ec
...
...
@@ -31,6 +31,12 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
end
end
def
omniauth_error
@provider
=
params
[
:provider
]
@error
=
params
[
:error
]
render
'errors/omniauth_error'
,
layout:
"errors"
,
status:
422
end
private
def
handle_omniauth
...
...
@@ -54,7 +60,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
else
if
errors
error_message
=
errors
.
map
{
|
attribute
,
message
|
"
#{
attribute
}
#{
message
}
"
}.
join
(
", "
)
flash
[
:notice
]
=
"There was a problem creating your account.
#{
error_message
}
"
redirect_to
omniauth_error_path
(
oauth
[
'provider'
],
error:
error_message
)
and
return
else
flash
[
:notice
]
=
"There's no such user!"
end
...
...
config/routes.rb
View file @
49c9e8ec
...
...
@@ -160,6 +160,9 @@ Gitlab::Application.routes.draw do
devise_for
:users
,
controllers:
{
omniauth_callbacks: :omniauth_callbacks
,
registrations: :registrations
,
passwords: :passwords
,
sessions: :users_sessions
}
devise_scope
:user
do
get
"/users/auth/:provider/omniauth_error"
=>
"omniauth_callbacks#omniauth_error"
,
as: :omniauth_error
end
#
# Project Area
#
...
...
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