Sha256: b11438c749a7e12ffe4f1cfb243eabe6fae96c769be0dc2e5bd813c91627b571

Contents?: true

Size: 735 Bytes

Versions: 21

Compression:

Stored size: 735 Bytes

Contents

require_dependency "wbase/application_controller"

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

    def new
      @user = User.new
      @user.email = cookies[:email] if cookies[:email]
    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

21 entries across 21 versions & 1 rubygems

Version Path
wbase-0.3.20 app/controllers/wbase/sessions_controller.rb
wbase-0.3.19 app/controllers/wbase/sessions_controller.rb
wbase-0.3.18 app/controllers/wbase/sessions_controller.rb
wbase-0.3.17 app/controllers/wbase/sessions_controller.rb
wbase-0.3.16 app/controllers/wbase/sessions_controller.rb
wbase-0.3.15 app/controllers/wbase/sessions_controller.rb
wbase-0.3.14 app/controllers/wbase/sessions_controller.rb
wbase-0.3.13 app/controllers/wbase/sessions_controller.rb
wbase-0.3.12 app/controllers/wbase/sessions_controller.rb
wbase-0.3.11 app/controllers/wbase/sessions_controller.rb
wbase-0.3.10 app/controllers/wbase/sessions_controller.rb
wbase-0.3.9 app/controllers/wbase/sessions_controller.rb
wbase-0.3.8 app/controllers/wbase/sessions_controller.rb
wbase-0.3.7 app/controllers/wbase/sessions_controller.rb
wbase-0.3.6 app/controllers/wbase/sessions_controller.rb
wbase-0.3.5 app/controllers/wbase/sessions_controller.rb
wbase-0.3.4 app/controllers/wbase/sessions_controller.rb
wbase-0.3.3 app/controllers/wbase/sessions_controller.rb
wbase-0.3.2 app/controllers/wbase/sessions_controller.rb
wbase-0.3.1 app/controllers/wbase/sessions_controller.rb