Github SSO added

This commit is contained in:
Christoph Haas 2017-04-19 00:15:29 +02:00
parent 65723d3063
commit b24abd7328
6 changed files with 23 additions and 8 deletions

View file

@ -19,7 +19,17 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
login_via 'Amazon'
end
def github
login_via 'Github'
end
def failure
redirect_to root_path
end
def login_via(provider_name)
# TODO: log
# You need to implement the method below in your model (e.g. app/models/user.rb)
@user = User.from_omniauth(request.env["omniauth.auth"])
@ -31,8 +41,4 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
end
end
def failure
redirect_to root_path
end
end

View file

@ -14,7 +14,8 @@ class User < ApplicationRecord
:launchpad,
:stackexchange,
:google_oauth2,
:amazon
:amazon,
:github
]

View file

@ -41,6 +41,7 @@
= link_to "Sign in with StackExchange", user_stackexchange_omniauth_authorize_path
= link_to "Sign in with Google", user_google_oauth2_omniauth_authorize_path
= link_to "Sign in with Amazon", user_amazon_omniauth_authorize_path
= link_to "Sign in with Github", user_github_omniauth_authorize_path
/ div
/ = link_to image_tag('/images/sso/google.png'), user_google_oauth2_omniauth_authorize_path