Sha256: 45c472ca494db8cde59c73485f59e4e0c754ed9c97c3e35751a5fe93900a0a4c

Contents?: true

Size: 352 Bytes

Versions: 12

Compression:

Stored size: 352 Bytes

Contents

class SessionsController < ApplicationController

	before_action :require_no_user, except: [:destroy]
	
	def new
	end

	def create
		user = User.authenticate(params[:email], params[:password])

		if user
			set_current_user(user)
			redirect_to root_url
		else
			render :new
		end
	end
	
	def destroy
		reset_session
		redirect_to root_url
	end	

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
jt-rails-generator-user-1.1.3 lib/generators/jt/user/templates/controllers/sessions_controller.rb
jt-rails-generator-user-1.1.2 lib/generators/jt/user/templates/controllers/sessions_controller.rb
jt-rails-generator-user-1.1.1 lib/generators/jt/user/templates/controllers/sessions_controller.rb
jt-rails-generator-user-1.1.0 lib/generators/jt/user/templates/controllers/sessions_controller.rb
jt-rails-generator-user-1.0.7 lib/generators/jt/user/templates/controllers/sessions_controller.rb
jt-rails-generator-user-1.0.6 lib/generators/jt/user/templates/controllers/sessions_controller.rb
jt-rails-generator-user-1.0.5 lib/generators/jt/user/templates/controllers/sessions_controller.rb
jt-rails-generator-user-1.0.4 lib/generators/jt/user/templates/controllers/sessions_controller.rb
jt-rails-generator-user-1.0.3 lib/generators/jt/user/templates/controllers/sessions_controller.rb
jt-rails-generator-user-1.0.2 lib/generators/jt/user/templates/controllers/sessions_controller.rb
jt-rails-generator-user-1.0.1 lib/generators/jt/user/templates/controllers/sessions_controller.rb
jt-rails-generator-user-1.0.0 lib/generators/jt/user/templates/controllers/sessions_controller.rb