Class: JustOpenId::SessionsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/just_open_id/sessions_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



8
9
10
11
12
13
# File 'app/controllers/just_open_id/sessions_controller.rb', line 8

def create
  auth = request.env["omniauth.auth"]
  user = User.find_by_provider_and_uid(auth["provider"], auth["uid"]) || User.create_with_omniauth(auth)
  session[:user_id] = user.id
  redirect_to root_url, :notice => "Signed in!"
end

#destroyObject



15
16
17
18
# File 'app/controllers/just_open_id/sessions_controller.rb', line 15

def destroy
  session[:user_id] = nil
  redirect_to root_url, :notice => "Signed out!"
end