Sha256: cbce9cc96eb3d4f17974bc353afa1fcd6a6de12ef36fa260e619649670253ac8
Contents?: true
Size: 1.07 KB
Versions: 13
Compression:
Stored size: 1.07 KB
Contents
module Godmin module Authentication module SessionsController extend ActiveSupport::Concern included do layout "godmin/login" end def new @admin_user = admin_user_class.new end def create @admin_user = admin_user_class.find_by_login(admin_user_login) if @admin_user && @admin_user.authenticate(admin_user_params[:password]) session[:admin_user_id] = @admin_user.id redirect_to root_path, notice: t("godmin.sessions.signed_in") else redirect_to new_session_path, alert: t("godmin.sessions.failed_sign_in") end end def destroy session[:admin_user_id] = nil redirect_to new_session_path, notice: t("godmin.sessions.signed_out") end private def admin_user_login admin_user_params[admin_user_class.login_column] end def admin_user_params params.require(:admin_user).permit( admin_user_class.login_column, :password, :password_confirm ) end end end end
Version data entries
13 entries across 13 versions & 1 rubygems