-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from osbridge/with_omniauth
Switch to using OmniAuth for authentication
- Loading branch information
Showing
100 changed files
with
1,014 additions
and
2,919 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
class AuthenticationsController < ApplicationController | ||
before_filter :require_auth_hash, :only => [:create] | ||
|
||
def sign_in | ||
page_title "Sign In" | ||
end | ||
|
||
def sign_out | ||
cookies.delete :auth_token | ||
reset_session | ||
flash[:notice] = "You have been logged out." | ||
|
||
redirect_back_or_default | ||
end | ||
|
||
def create | ||
@authentication = Authentication.find_and_update_or_create_from_auth_hash(auth_hash) | ||
|
||
if @authentication.user | ||
self.current_user = @authentication.user | ||
elsif logged_in? | ||
@authentication.user = current_user | ||
@authentication.save | ||
else | ||
self.current_user = User.create_from_authentication(@authentication) | ||
end | ||
|
||
redirect_back_or_default | ||
end | ||
|
||
protected | ||
|
||
def auth_hash | ||
request.env['omniauth.auth'] | ||
end | ||
|
||
def require_auth_hash | ||
redirect_to(sign_in_path) and return unless auth_hash | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.