tap/app/controllers/sessions_controller.rb

22 lines
335 B
Ruby
Raw Normal View History

2014-11-06 18:30:53 +01:00
class SessionsController < ApplicationController
def new
end
def create
user = User.find_by(name: params[:session][:name])
if user
log_in user
redirect_to user
else
#flash.now[:danger] = 'Invalid username'
render 'new'
end
end
def destroy
2014-11-06 18:56:00 +01:00
log_out
redirect_to root_url
2014-11-06 18:30:53 +01:00
end
end