Sha256: 25359b5959e5ba3f6911466d866592c160797685416eacf5491cf8b47dbb797f
Contents?: true
Size: 644 Bytes
Versions: 3
Compression:
Stored size: 644 Bytes
Contents
# frozen_string_literal: true class SessionsController < ApplicationController def new @input = SessionInput.new @result = @action.perform end def create @input = SessionInput.new(session_params) @result = @action.perform(@input) if @result.success? reset_session session[:user_id] = @result.current_user.id redirect_to(root_path) else render(:new) end end def destroy reset_session redirect_to(root_path) end private # Only allow a list of trusted parameters through. def session_params params.require(:session_input).permit(:email, :password) end end
Version data entries
3 entries across 3 versions & 1 rubygems