Sha256: 180b240f4208666848e3643529a811ba2e349cd25d6e15320fabdf8bff28b3e9

Contents?: true

Size: 526 Bytes

Versions: 26

Compression:

Stored size: 526 Bytes

Contents

class SessionsController < ApplicationController

  def new
  end

  def create
    @user = User.find_by_name(params[:session][:name])
    if @user && @user.authenticate(params[:session][:password])
      sign_in(@user, permanent: params[:session][:remember_me] == "1")
      redirect_back_or root_path, success: "Signed in"
    else
      flash.now[:error] = "Incorrect user/password"
      render 'new'
    end
  end

  def destroy
    require_login!
    sign_out
    redirect_to root_path, success: "Signed out"
  end

end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
adeia-0.11.0 spec/test_app/app/controllers/sessions_controller.rb
adeia-0.10.5 spec/test_app/app/controllers/sessions_controller.rb
adeia-0.10.4 spec/test_app/app/controllers/sessions_controller.rb
adeia-0.10.3 spec/test_app/app/controllers/sessions_controller.rb
adeia-0.10.2 spec/test_app/app/controllers/sessions_controller.rb
adeia-0.10.1 spec/test_app/app/controllers/sessions_controller.rb