Sha256: 838c1e4ae65724dd041e64357ade4ac7d011a3f4331595acc091e2beeacb8f3c
Contents?: true
Size: 686 Bytes
Versions: 7
Compression:
Stored size: 686 Bytes
Contents
# frozen_string_literal: true class SessionsController < ::ApplicationController def create user = find_user(params[:username], params[:password]) authenticate!(user) if user if logged_in? redirect_to admin_default_url else flash[:notice] = "The provided email address and password combination " \ "was not valid" redirect_to login_admin_users_url end end def destroy flash[:notice] = "You have been logged out" deauthenticate! redirect_to login_admin_users_url end protected def find_user(username, password) User.authenticate(username, password: password) if username && password end end
Version data entries
7 entries across 7 versions & 1 rubygems