Sha256: b09c35eb53698807c9615eb39c00ab5cb559a6d5f99b3b5aec1db38f0cb69a05

Contents?: true

Size: 680 Bytes

Versions: 28

Compression:

Stored size: 680 Bytes

Contents

require_dependency "wbase/application_controller"

module Wbase
  class SessionsController < ApplicationController
    layout 'wbase/auth'

    def new
      @user = User.new
    end

    def create
      @user = User.find_by_params(user_params)
      if @user
        login(@user)
        redirect_to '/'
      else
        @user = User.new(user_params)
        flash.now[:errors] = [
          'Hmm. There is not a user with that email / password combo. Try again?']
        render :new
      end
    end

    def destroy
      logout
      redirect_to '/welcome'
    end

    private

    def user_params
      params.require(:user).permit(:email, :password)
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
wbase-0.2.9 app/controllers/wbase/sessions_controller.rb
wbase-0.2.8 app/controllers/wbase/sessions_controller.rb
wbase-0.2.7 app/controllers/wbase/sessions_controller.rb
wbase-0.2.6 app/controllers/wbase/sessions_controller.rb
wbase-0.2.5 app/controllers/wbase/sessions_controller.rb
wbase-0.2.4 app/controllers/wbase/sessions_controller.rb
wbase-0.2.3 app/controllers/wbase/sessions_controller.rb
wbase-0.2.2 app/controllers/wbase/sessions_controller.rb
wbase-0.2.1 app/controllers/wbase/sessions_controller.rb
wbase-0.2.0 app/controllers/wbase/sessions_controller.rb
wbase-0.1.7 app/controllers/wbase/sessions_controller.rb
wbase-0.1.6 app/controllers/wbase/sessions_controller.rb
wbase-0.1.5 app/controllers/wbase/sessions_controller.rb
wbase-0.1.4 app/controllers/wbase/sessions_controller.rb
wbase-0.1.3 app/controllers/wbase/sessions_controller.rb
wbase-0.1.2 app/controllers/wbase/sessions_controller.rb
wbase-0.1.0 app/controllers/wbase/sessions_controller.rb
wbase-0.0.15 app/controllers/wbase/sessions_controller.rb
wbase-0.0.14 app/controllers/wbase/sessions_controller.rb
wbase-0.0.13 app/controllers/wbase/sessions_controller.rb