BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
omniauth_callbacks_controller.rb
app/controllers/omniauth_callbacks_controller.rb
+7
-1
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
...
@@ -31,6 +31,12 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
end
end
end
end
def
omniauth_error
@provider
=
params
[
:provider
]
@error
=
params
[
:error
]
render
'errors/omniauth_error'
,
layout:
"errors"
,
status:
422
end
private
private
def
handle_omniauth
def
handle_omniauth
...
@@ -54,7 +60,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
...
@@ -54,7 +60,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
else
else
if
errors
if
errors
error_message
=
errors
.
map
{
|
attribute
,
message
|
"
#{
attribute
}
#{
message
}
"
}.
join
(
", "
)
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
else
flash
[
:notice
]
=
"There's no such user!"
flash
[
:notice
]
=
"There's no such user!"
end
end
...
...
config/routes.rb
View file @
49c9e8ec
...
@@ -160,6 +160,9 @@ Gitlab::Application.routes.draw do
...
@@ -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_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
# 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