Sha256: 74391ecb2405583378d4c699eeeba1bc8f1b6b9a6dc20eca454a34e249d8eab7

Contents?: true

Size: 428 Bytes

Versions: 3

Compression:

Stored size: 428 Bytes

Contents

class UserSessionsController < BeautifulController

  skip_before_action :require_login, only: [:new, :create]

  def create
    @user = login(params[:email], params[:password])

    if @user
      redirect_back_or_to(:users, notice: 'Login successful')
    else
      flash.now[:alert] = 'Login failed'
      render action: 'new'
    end
  end

  def destroy
    logout
    redirect_to(:users, notice: 'Logged out!')
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
beautiful_scaffold-2.0.3 lib/generators/templates/app/controllers/user_sessions_controller.rb
beautiful_scaffold-2.0.2 lib/generators/templates/app/controllers/user_sessions_controller.rb
beautiful_scaffold-2.0.1 lib/generators/templates/app/controllers/user_sessions_controller.rb