Module: Godmin::Authentication::SessionsController

Extended by:
ActiveSupport::Concern
Defined in:
lib/godmin/authentication/sessions_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/godmin/authentication/sessions_controller.rb', line 15

def create
  @admin_user = admin_user_class.()

  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

#destroyObject



26
27
28
29
# File 'lib/godmin/authentication/sessions_controller.rb', line 26

def destroy
  session[:admin_user_id] = nil
  redirect_to new_session_path, notice: t("godmin.sessions.signed_out")
end

#newObject



11
12
13
# File 'lib/godmin/authentication/sessions_controller.rb', line 11

def new
  @admin_user = admin_user_class.new
end