Bike!Bike! Website!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

21 lines
469 B

class UserSessionsController < ApplicationController
def new
session[:return_to] ||= request.referer
@user = User.new
end
def create
if @user = login(params[:email], params[:password])
#redirect_back_or_to(:users, notice: 'Login successful')
redirect_to session.delete(:return_to)
else
flash.now[:alert] = "Login failed"
render action: "new"
end
end
def destroy
logout
redirect_to(:users, notice: 'Logged out!')
end
end