Sha256: 6813dd06460d4d59221d03fef7062282baa3db13b73834e9938a298597ed5e4a
Contents?: true
Size: 1.18 KB
Versions: 4
Compression:
Stored size: 1.18 KB
Contents
# frozen_string_literal # Controller for managing sessions for <%= plural_class_name %>. # Automatically generated by the orthodox gem (https://github.com/katanacode/orthodox) # (c) Copyright 2019 Katana Code Ltd. All Rights Reserved. class <%= plural_class_name %>::SessionsController < <%= plural_class_name %>::BaseController skip_before_action :authenticate_<%= singular_name %> def new @<%= singular_name %>_session = <%= class_name %>Session.new(<%= singular_name %>_session_params) end def create @<%= singular_name %>_session = <%= class_name %>Session.new(<%= singular_name %>_session_params) if @<%= singular_name %>_session.valid? sign_in(@<%= singular_name %>_session.<%= singular_name %>, as: :<%= singular_name %>) redirect_to(<%= plural_name %>_dashboard_url, notice: "Successfully signed in") else render :new end end def destroy sign_out(:<%= singular_name %>) redirect_to root_url, notice: "Successfully signed out" end private def <%= singular_name %>_session_params return {} unless params.key?(:<%= singular_name %>_session) params.require(:<%= singular_name %>_session).permit(:email, :password) end end
Version data entries
4 entries across 4 versions & 1 rubygems