mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2024-12-22 15:43:14 +01:00
readd sessions_controller
This commit is contained in:
parent
652f3516ae
commit
16d6b7c389
2 changed files with 21 additions and 0 deletions
19
app/controllers/sessions_controller.rb
Normal file
19
app/controllers/sessions_controller.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
class SessionsController < ApplicationController
|
||||
def create
|
||||
if user = User.find_or_create_from_auth_hash(auth_hash)
|
||||
session[:user_id] = user.id
|
||||
end
|
||||
redirect_to root_path
|
||||
end
|
||||
|
||||
def destroy
|
||||
reset_session
|
||||
redirect_to root_path
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def auth_hash
|
||||
request.env['omniauth.auth']
|
||||
end
|
||||
end
|
|
@ -3,6 +3,8 @@ Rails.application.routes.draw do
|
|||
|
||||
post '/import' => 'import#new_papers_callback'
|
||||
get '/' => 'search#index', as: :search
|
||||
|
||||
resource :session, only: [:create, :destroy]
|
||||
|
||||
# Example of regular route:
|
||||
# get 'products/:id' => 'catalog#view'
|
||||
|
|
Loading…
Reference in a new issue