Class: SessionsController

Inherits:
ApplicationController show all
Defined in:
lib/templates/app/controllers/sessions_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/templates/app/controllers/sessions_controller.rb', line 2

def create
  auth = request.env['rack.auth']
  Rails.logger.info auth.inspect
  unless @auth = Authorization.find_from_hash(auth)
    # Create a new user or add an auth to existing user, depending on
    # whether there is already a user signed in.
    @auth = Authorization.create_from_hash(auth, current_user)
  end
  # Log the authorizing user in.
  self.current_user = @auth.user
  
  redirect_to user_path(self.current_user), :notice => "Welcome, #{current_user.name}."
end