Salsa login works
This commit is contained in:
parent
b2ed771663
commit
bc507cbe39
6 changed files with 84 additions and 51 deletions
|
|
@ -3,29 +3,33 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
|||
# Workaround for https://github.com/plataformatec/devise/issues/2432
|
||||
# skip_before_filter :verify_authenticity_token
|
||||
|
||||
def launchpad
|
||||
login_via 'Launchpad'
|
||||
def salsa
|
||||
login_via 'salsa.debian.org'
|
||||
end
|
||||
|
||||
def stackexchange
|
||||
login_via 'StackExchange'
|
||||
end
|
||||
# def launchpad
|
||||
# login_via 'Launchpad'
|
||||
# end
|
||||
|
||||
def google_oauth2
|
||||
login_via 'Google'
|
||||
end
|
||||
# def stackexchange
|
||||
# login_via 'StackExchange'
|
||||
# end
|
||||
|
||||
def amazon
|
||||
login_via 'Amazon'
|
||||
end
|
||||
# def google_oauth2
|
||||
# login_via 'Google'
|
||||
# end
|
||||
|
||||
def github
|
||||
login_via 'Github'
|
||||
end
|
||||
# def amazon
|
||||
# login_via 'Amazon'
|
||||
# end
|
||||
|
||||
def failure
|
||||
redirect_to root_path
|
||||
end
|
||||
# def github
|
||||
# login_via 'Github'
|
||||
# end
|
||||
|
||||
# def failure
|
||||
# redirect_to root_path
|
||||
# end
|
||||
|
||||
def login_via(provider_name)
|
||||
# TODO: log
|
||||
|
|
|
|||
|
|
@ -11,29 +11,30 @@ class User < ApplicationRecord
|
|||
# :validatable,
|
||||
:timeoutable,
|
||||
# :lockable,
|
||||
:omniauthable, :omniauth_providers => [
|
||||
:launchpad,
|
||||
:stackexchange,
|
||||
:google_oauth2,
|
||||
:amazon,
|
||||
:github
|
||||
:omniauthable, omniauth_providers: [
|
||||
:salsa,
|
||||
# :launchpad,
|
||||
# :stackexchange,
|
||||
# :google_oauth2,
|
||||
# :amazon,
|
||||
# :github
|
||||
]
|
||||
|
||||
# Return a human-friendly string describing the user's SSO provider
|
||||
def pretty_provider
|
||||
case self.provider
|
||||
when 'launchpad'
|
||||
'Ubuntu One/Launchpad'
|
||||
when 'stackexchange'
|
||||
'StackExchange'
|
||||
when 'google_oauth2'
|
||||
'Google'
|
||||
when 'amazon'
|
||||
'Amazon'
|
||||
when 'github'
|
||||
'GitHub'
|
||||
when 'debian-sso'
|
||||
'Debian single-sign-on'
|
||||
# when 'launchpad'
|
||||
# 'Ubuntu One/Launchpad'
|
||||
# when 'stackexchange'
|
||||
# 'StackExchange'
|
||||
# when 'google_oauth2'
|
||||
# 'Google'
|
||||
# when 'amazon'
|
||||
# 'Amazon'
|
||||
# when 'github'
|
||||
# 'GitHub'
|
||||
when 'salsa'
|
||||
'salsa.debian.org'
|
||||
else
|
||||
'local authentication'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -28,9 +28,12 @@
|
|||
/ a href='https://sso.debian.org/' Debian SSO
|
||||
/ ' installed in your browser.
|
||||
|
||||
/ .grid-container
|
||||
/ .text-center
|
||||
|
||||
.grid-container
|
||||
.text-center
|
||||
|
||||
p
|
||||
= link_to (fa_icon 'login', text: 'Login with Debian'), user_salsa_omniauth_authorize_path, class: 'button primary large', method: :post
|
||||
|
||||
/ // Alternative way to display buttons without images. (Amazon wants their own button though.)
|
||||
/ / p
|
||||
/ / = link_to (fa_icon 'google', text: '- Login with Google'), user_google_oauth2_omniauth_authorize_path, class: 'button secondary large'
|
||||
|
|
|
|||
|
|
@ -30,3 +30,5 @@
|
|||
- if current_user.is_admin?
|
||||
h2 Admin
|
||||
p Apparently you are an administrator. Be careful with that thing!
|
||||
|
||||
tt = current_user.inspect
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue