Sha256: cc1f25896823673d846985a1f48dbf535ed441b33c112b49e7375d70b14440aa
Contents?: true
Size: 967 Bytes
Versions: 10
Compression:
Stored size: 967 Bytes
Contents
class SessionsController < ApplicationController skip_before_action :authenticate, except: :destroy def new @<%= singular_table_name %> = <%= class_name %>.new end def create @<%= singular_table_name %> = <%= class_name %>.find_by_email(params[:email]) if @<%= singular_table_name %>.try(:authenticate, params[:password]) if params[:remember_me] == "1" cookies.signed.permanent[:session_token] = { value: @<%= singular_table_name %>.session_token, httponly: true } else cookies.signed[:session_token] = { value: @<%= singular_table_name %>.session_token, httponly: true } end redirect_to root_path, notice: "Signed in successfully" else redirect_to sign_in_path(email_hint: params[:email]), alert: "Invalid email or password" end end def destroy Current.<%= singular_table_name %>.regenerate_session_token redirect_to sign_in_path, notice: "Signed out successfully" end end
Version data entries
10 entries across 10 versions & 1 rubygems