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
410 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_to session.delete(:return_to) || 'pages#home'
else
flash.now[:alert] = "Login failed"
render action: "new"
end
end
def destroy
logout
redirect_to(:users, notice: 'Logged out!')
end
end