Class: SessionsController

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

Instance Method Summary collapse

Instance Method Details

#createObject



4
5
6
7
8
9
# File 'app/controllers/sessions_controller.rb', line 4

def create
  auth = request.env["omniauth.auth"]
  user = User.find_or_create_with_omniauth(auth)
  session[:user_id] = user.id
  redirect_to redirect_path, :notice => "Bem Vindo! Você agora está logado."
end

#destroyObject



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

def destroy
  session[:user_id] = nil
  redirect_to root_path, :notice => "Obrigado! Volte em breve."
end

#failureObject



11
12
13
# File 'app/controllers/sessions_controller.rb', line 11

def failure
  redirect_to redirect_path, :alert => 'Não foi possível autenticar, tente novamente.'
end