Sha256: 518608d230012afae58c5661f6668c42eaf2fb6ad46cbb87e7caed09991abe4d

Contents?: true

Size: 483 Bytes

Versions: 11

Compression:

Stored size: 483 Bytes

Contents

class SessionsController < ApplicationController
  def new
  end

  def create
    @user = User.find_by(email: params[:email])
    if @user && @user.authenticate(params[:password])
      session[:user_id] = @user.id
      redirect_to params[:return_to] || root_url, notice: "Logged in!"
    else
      flash[:warning] = "You have entered incorrect email and/or password."
      render :new
    end
  end

  def destroy
    session.delete(:user_id)
    redirect_to root_path
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
mobile_workflow-0.5.7 lib/generators/mobile_workflow/install/templates/sessions_controller.rb.erb
mobile_workflow-0.5.6 lib/generators/mobile_workflow/install/templates/sessions_controller.rb.erb
mobile_workflow-0.5.5 lib/generators/mobile_workflow/install/templates/sessions_controller.rb.erb
mobile_workflow-0.5.4 lib/generators/mobile_workflow/install/templates/sessions_controller.rb.erb
mobile_workflow-0.5.3 lib/generators/mobile_workflow/install/templates/sessions_controller.rb.erb
mobile_workflow-0.5.2 lib/generators/mobile_workflow/install/templates/sessions_controller.rb.erb
mobile_workflow-0.5.1 lib/generators/mobile_workflow/install/templates/sessions_controller.rb.erb
mobile_workflow-0.5.0 lib/generators/mobile_workflow/install/templates/sessions_controller.rb.erb
mobile_workflow-0.4.0 lib/generators/mobile_workflow/install/templates/sessions_controller.rb.erb
mobile_workflow-0.3.1 lib/generators/mobile_workflow/install/templates/sessions_controller.rb.erb
mobile_workflow-0.2.0 lib/generators/mobile_workflow/install/templates/sessions_controller.rb.erb