22 lines
482 B
Ruby
22 lines
482 B
Ruby
# this is not a jam session - this is an 'auth session'
|
|
class SessionsController < ApplicationController
|
|
|
|
def new
|
|
end
|
|
|
|
def create
|
|
user = User.find_by_email(params[:session][:email])
|
|
if user && user.authenticate(params[:session][:password])
|
|
sign_in user
|
|
redirect_back_or music_sessions_url
|
|
else
|
|
flash.now[:error] = 'Invalid email/password combination'
|
|
render 'new'
|
|
end
|
|
end
|
|
|
|
def destroy
|
|
sign_out
|
|
redirect_to root_url
|
|
end
|
|
end |