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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
17a41547
Commit
17a41547
authored
May 12, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve OAuth signup error message.
parent
9eb45ccd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
app/controllers/omniauth_callbacks_controller.rb
app/controllers/omniauth_callbacks_controller.rb
+9
-2
lib/gitlab/o_auth/user.rb
lib/gitlab/o_auth/user.rb
+2
-2
No files found.
app/controllers/omniauth_callbacks_controller.rb
View file @
17a41547
...
...
@@ -65,8 +65,15 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
redirect_to
omniauth_error_path
(
oauth
[
'provider'
],
error:
error_message
)
and
return
end
end
rescue
Gitlab
::
OAuth
::
ForbiddenAction
=>
e
flash
[
:notice
]
=
e
.
message
rescue
Gitlab
::
OAuth
::
SignupDisabledError
=>
e
message
=
"Signing in using your
#{
oauth
[
'provider'
]
}
account without a pre-existing GitLab account is not allowed."
if
current_application_settings
.
signup_enabled?
message
<<
" Create a GitLab account first, and then connect it to your
#{
oauth
[
'provider'
]
}
account."
end
flash
[
:notice
]
=
message
redirect_to
new_user_session_path
end
...
...
lib/gitlab/o_auth/user.rb
View file @
17a41547
...
...
@@ -5,7 +5,7 @@
#
module
Gitlab
module
OAuth
class
ForbiddenAction
<
StandardError
;
end
class
SignupDisabledError
<
StandardError
;
end
class
User
attr_accessor
:auth_hash
,
:gl_user
...
...
@@ -99,7 +99,7 @@ module Gitlab
end
def
unauthorized_to_create
raise
ForbiddenAction
.
new
(
"Unauthorized to create user, signup disabled for
#{
auth_hash
.
provider
}
"
)
raise
SignupDisabledError
end
end
end
...
...
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