Sha256: 41bee973d6006bb7a1be611d138e13df5c82b3556350ade4000acb2bf1a94683

Contents?: true

Size: 567 Bytes

Versions: 16

Compression:

Stored size: 567 Bytes

Contents

class SessionsController < ApplicationController
  
  def new
  end

  def create
    @user = User.authenticate(params[:email], params[:password])
    if @user
      if params[:remember_me]
        cookies.permanent[:auth_token] = @user.auth_token
      else
        cookies[:auth_token] = @user.auth_token  
      end

      redirect_to root_url, notice: "Logged in!"
    else
      flash.now.alert = "Invalid email or password"
      render "new"
    end
  end

  def destroy
    cookies.delete(:auth_token)
    redirect_to root_url, notice: "Logged out!"
  end
end

Version data entries

16 entries across 8 versions & 1 rubygems

Version Path
authpro-1.1.0 test/rails/dummy/app/controllers/sessions_controller.rb
authpro-1.1.0 lib/generators/authpro/templates/sessions_controller.rb
authpro-1.0.1 test/rails/dummy/app/controllers/sessions_controller.rb
authpro-1.0.1 lib/generators/authpro/templates/sessions_controller.rb
authpro-1.0.0 lib/generators/authpro/templates/sessions_controller.rb
authpro-1.0.0 test/rails/dummy/app/controllers/sessions_controller.rb
authpro-0.9.3 lib/generators/authpro/templates/sessions_controller.rb
authpro-0.9.3 test/rails/dummy/app/controllers/sessions_controller.rb
authpro-0.9.2 lib/generators/authpro/templates/sessions_controller.rb
authpro-0.9.2 test/rails/dummy/app/controllers/sessions_controller.rb
authpro-0.9.1 lib/generators/authpro/templates/sessions_controller.rb
authpro-0.9.1 test/rails/dummy/app/controllers/sessions_controller.rb
authpro-0.9.0 test/rails/dummy/app/controllers/sessions_controller.rb
authpro-0.9.0 lib/generators/authpro/templates/sessions_controller.rb
authpro-0.1.0 lib/generators/authpro/templates/sessions_controller.rb
authpro-0.1.0 test/rails/dummy/app/controllers/sessions_controller.rb