Sha256: 148b23585fbe2d29abdb6e5d0bb78759777b246f39b5d888bf9fa994a6200457

Contents?: true

Size: 764 Bytes

Versions: 3

Compression:

Stored size: 764 Bytes

Contents

module Session
  
  # ---------------------------------------------------------------------------
  # Check auth
  get "/" do
    if console_auth?
      erb :'session/login'
    else 
      redirect '/mission'
    end
  end
  
  # ---------------------------------------------------------------------------
  # Log out  
  get "/session/delete" do
    session.clear
    redirect '/'
  end
  
  # ---------------------------------------------------------------------------
  # Check credentials
  post "/session/create" do
    if authenticate( params[:login] )
      session[:user] = params[:login][:username]
      redirect '/mission'
    else
      flash_it!( :error, "Authentication failed! Please check credentials." )      
      redirect '/'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wackamole-0.1.4 lib/controllers/session.rb
wackamole-0.1.3 lib/controllers/session.rb
wackamole-0.1.2 lib/controllers/session.rb