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.0.12 app/controllers/wbase/sessions_controller.rb
wbase-0.0.11 app/controllers/wbase/sessions_controller.rb
wbase-0.0.10 app/controllers/wbase/sessions_controller.rb
wbase-0.0.9 app/controllers/wbase/sessions_controller.rb
wbase-0.0.8 app/controllers/wbase/sessions_controller.rb
wbase-0.0.7 app/controllers/wbase/sessions_controller.rb
wbase-0.0.6 app/controllers/wbase/sessions_controller.rb
wbase-0.0.5 app/controllers/wbase/sessions_controller.rb