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
Tatuya Kamada
gitlab-ce
Commits
fa4150d4
Commit
fa4150d4
authored
Sep 12, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup after omniauth
parent
486de8c3
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
49 additions
and
47 deletions
+49
-47
app/assets/stylesheets/auth_methods.scss
app/assets/stylesheets/auth_methods.scss
+0
-10
app/assets/stylesheets/gitlab_bootstrap/blocks.scss
app/assets/stylesheets/gitlab_bootstrap/blocks.scss
+4
-0
app/assets/stylesheets/main.scss
app/assets/stylesheets/main.scss
+0
-1
app/controllers/omniauth_callbacks_controller.rb
app/controllers/omniauth_callbacks_controller.rb
+5
-6
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+3
-2
app/views/devise/sessions/new.html.haml
app/views/devise/sessions/new.html.haml
+5
-4
app/views/profile/password.html.haml
app/views/profile/password.html.haml
+3
-3
app/views/profile/show.html.haml
app/views/profile/show.html.haml
+25
-19
config/gitlab.yml.example
config/gitlab.yml.example
+4
-2
No files found.
app/assets/stylesheets/auth_methods.scss
deleted
100644 → 0
View file @
486de8c3
.auth_methods
{
ul
{
margin
:
0
;
text-align
:center
;
padding
:
5px
;
li
{
display
:
inline
;
}
}
}
app/assets/stylesheets/gitlab_bootstrap/blocks.scss
View file @
fa4150d4
...
@@ -142,4 +142,8 @@
...
@@ -142,4 +142,8 @@
border
:none
;
border
:none
;
}
}
}
}
.ui-box-body
{
padding
:
10px
;
}
}
}
app/assets/stylesheets/main.scss
View file @
fa4150d4
...
@@ -134,7 +134,6 @@ $hover: #fdf5d9;
...
@@ -134,7 +134,6 @@ $hover: #fdf5d9;
* TODO: clean it
* TODO: clean it
*/
*/
@import
"common.scss"
;
@import
"common.scss"
;
@import
"auth_methods.scss"
;
/**
/**
* Styles related to specific part of app
* Styles related to specific part of app
...
...
app/controllers/omniauth_callbacks_controller.rb
View file @
fa4150d4
class
OmniauthCallbacksController
<
Devise
::
OmniauthCallbacksController
class
OmniauthCallbacksController
<
Devise
::
OmniauthCallbacksController
Gitlab
.
config
.
omniauth_providers
.
each
do
|
provider
|
define_method
provider
[
'name'
]
do
handle_omniauth
end
end
# Extend the standard message generation to accept our custom exception
# Extend the standard message generation to accept our custom exception
def
failure_message
def
failure_message
...
@@ -19,12 +24,6 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
...
@@ -19,12 +24,6 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
sign_in_and_redirect
@user
sign_in_and_redirect
@user
end
end
Settings
.
omniauth_providers
.
each
do
|
provider
|
define_method
provider
[
'name'
]
do
handle_omniauth
end
end
private
private
def
handle_omniauth
def
handle_omniauth
...
...
app/helpers/application_helper.rb
View file @
fa4150d4
...
@@ -137,7 +137,8 @@ module ApplicationHelper
...
@@ -137,7 +137,8 @@ module ApplicationHelper
end
end
def
authbutton
(
provider
,
size
=
64
)
def
authbutton
(
provider
,
size
=
64
)
image_tag
(
"authbuttons/
#{
provider
.
to_s
.
split
(
'_'
).
first
}
_
#{
size
}
.png"
,
file_name
=
"
#{
provider
.
to_s
.
split
(
'_'
).
first
}
_
#{
size
}
.png"
alt:
"Sign in with
#{
provider
.
to_s
.
titleize
}
"
)
image_tag
(
"authbuttons/
#{
file_name
}
"
,
alt:
"Sign in with
#{
provider
.
to_s
.
titleize
}
"
)
end
end
end
end
app/views/devise/sessions/new.html.haml
View file @
fa4150d4
...
@@ -15,7 +15,8 @@
...
@@ -15,7 +15,8 @@
.right
.right
=
render
:partial
=>
"devise/shared/links"
=
render
:partial
=>
"devise/shared/links"
-
if
devise_mapping
.
omniauthable?
-
if
devise_mapping
.
omniauthable?
-
resource_class
.
omniauth_providers
.
each
do
|
provider
|
%hr
/
%hr
/
=
link_to
"Sign in with
#{
provider
.
to_s
.
titleize
}
"
,
omniauth_authorize_path
(
resource_name
,
provider
),
:class
=>
"btn primary"
%ul
.unstyled
%br
/
-
resource_class
.
omniauth_providers
.
each
do
|
provider
|
%li
=
link_to
authbutton
(
provider
,
32
),
omniauth_authorize_path
(
resource_name
,
provider
)
app/views/profile/password.html.haml
View file @
fa4150d4
...
@@ -19,11 +19,11 @@
...
@@ -19,11 +19,11 @@
=
f
.
label
:password_confirmation
=
f
.
label
:password_confirmation
.input
=
f
.
password_field
:password_confirmation
.input
=
f
.
password_field
:password_confirmation
-
if
Settings
.
omniauth
.
enabled
-
if
Gitlab
.
config
.
omniauth_enabled?
.span5.right
.span5.right
.a
uth_methods.a
lert.alert-info
.alert.alert-info
%strong
Tip: Use one of the following sites to login
%strong
Tip: Use one of the following sites to login
%ul
%ul
.unstyled
-
User
.
omniauth_providers
.
each
do
|
provider
|
-
User
.
omniauth_providers
.
each
do
|
provider
|
%li
=
link_to
authbutton
(
provider
),
|
%li
=
link_to
authbutton
(
provider
),
|
omniauth_authorize_path
(
User
,
provider
)
|
omniauth_authorize_path
(
User
,
provider
)
|
...
...
app/views/profile/show.html.haml
View file @
fa4150d4
...
@@ -50,13 +50,18 @@
...
@@ -50,13 +50,18 @@
%strong
Tip:
%strong
Tip:
You can change your avatar at gravatar.com
You can change your avatar at gravatar.com
-
if
Settings
.
omniauth
.
enabled
&&
@user
.
provider?
-
@user
.
provider
=
'twitter'
-
if
Gitlab
.
config
.
omniauth_enabled?
&&
@user
.
provider?
.ui-box
.ui-box-body
%h4
%h4
Omniauth Providers:
Omniauth Providers:
=
link_to
"Change"
,
profile_password_path
,
class:
"btn small right"
=
link_to
"Change"
,
profile_password_path
,
class:
"btn small right"
You can login through
#{
@user
.
provider
.
titleize
}
!
You can login through
#{
@user
.
provider
.
titleize
}
!
=
authbutton
(
@user
.
provider
,
32
)
=
authbutton
(
@user
.
provider
,
32
)
.ui-box
.ui-box-body
%h4
%h4
Personal projects:
Personal projects:
%small
.right
%small
.right
...
@@ -66,12 +71,13 @@
...
@@ -66,12 +71,13 @@
.progress
.progress
.bar
{
style:
"width: #{current_user.projects_limit_percent}%;"
}
.bar
{
style:
"width: #{current_user.projects_limit_percent}%;"
}
.ui-box
.ui-box-body
%h4
%h4
SSH public keys:
SSH public keys:
%small
.right
%strong
.right
=
link_to
current_user
.
keys
.
count
,
keys_path
%span
=
link_to
current_user
.
keys
.
count
,
keys_path
=
link_to
"Add Public Key"
,
new_key_path
,
class:
"btn small right
"
=
link_to
"Add Public Key"
,
new_key_path
,
class:
"btn small
"
.form-actions
.form-actions
=
f
.
submit
'Save'
,
class:
"btn save-btn"
=
f
.
submit
'Save'
,
class:
"btn save-btn"
config/gitlab.yml.example
View file @
fa4150d4
...
@@ -43,8 +43,6 @@ ldap:
...
@@ -43,8 +43,6 @@ ldap:
omniauth:
omniauth:
enabled: false
enabled: false
allow_single_sign_on: false
block_auto_created_users: true
providers:
providers:
# - { name: 'google_oauth2', app_id: 'YOUR APP ID',
# - { name: 'google_oauth2', app_id: 'YOUR APP ID',
# app_secret: 'YOUR APP SECRET',
# app_secret: 'YOUR APP SECRET',
...
@@ -53,6 +51,10 @@ omniauth:
...
@@ -53,6 +51,10 @@ omniauth:
# app_secret: 'YOUR APP SECRET'}
# app_secret: 'YOUR APP SECRET'}
# - { name: 'github', app_id: 'YOUR APP ID',
# - { name: 'github', app_id: 'YOUR APP ID',
# app_secret: 'YOUR APP SECRET' }
# app_secret: 'YOUR APP SECRET' }
# IMPORTANT!
# It allows user to login without having user account
allow_single_sign_on: false
block_auto_created_users: true
#
#
...
...
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