Sha256: d2677179faa2da7af28a74bcfd32630df9a94ee5efac360eb6c92b66719260f7

Contents?: true

Size: 601 Bytes

Versions: 1

Compression:

Stored size: 601 Bytes

Contents

class SessionsController < ApplicationController
  respond_to :html

  def new
    redirect_to assethost.a_assets_path if current_user
  end

  def create
    if user = User.authenticate(params[:username], params[:password])
      session[:user_id] = user.id
      redirect_to session[:return_to] || assethost.a_assets_path, notice: "Logged in."
      session[:return_to] = nil
    else
      flash.now[:error] = "Invalid login information."
      render :new
    end
  end

  def destroy
    @current_user = nil
    session[:user_id] = nil
    redirect_to login_path, notice: "Logged Out."
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
asset_host_core-2.0.0.beta spec/internal/app/controllers/sessions_controller.rb